Open In App

How to Run or Debug JavaScript in Sublime text ?

Last Updated : 21 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Freeware text and source code editor Sublime Text is available for users of Windows, macOS, and Linux. Its features can be expanded with plugins, which are developed and maintained under free software licenses by the local community, and users can customize it with themes. The editor includes an easy-to-use interface and provides features for programmers, including support for regular expressions in search and replace, code folding, an adjustable syntax highlighting function, a terminal output window, and many more.

Steps for running or debugging JavaScript in Sublime text:

Step 1: Download and install Node.js in your system. (If you have installed it, move to the next step)

Screenshot-2023-10-25-111557

Step 2: Open the Sublime text click on Tools>Build System> new Build System.

Screenshot-2023-10-25-111204Step 3: A screen will appear as follows:

Screenshot-2023-10-25-110439

Step 4: now replace the following content as given below:

   {
"cmd":["node", "$file"],
"selector": "main.js"
}

Screenshot-2023-10-25-104437

Step 5: Save the file as “JavaScript.sublime-build” in default user folder or else get into File>Save or CTRL + S.

Screenshot-2023-10-25-110459

Step 6: Close the file and again Navigate to Tools> Build System and now you can see the JavaScript and select it.
Screenshot-2023-10-25-110809

Step 7: Now you can run and debug the JavaScript. So test it we create a file named text.js. Here are the results.

Screenshot-2023-10-25-110002

You can also use multiple packages and tools based on your preferences and the needs of your project, so feel free to look into different possibilities to discover the one that best suits you.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads