MetroGnome
MetroGnome

Reputation: 81

Compiling/ running Javascript in Notepad++ [beginner question]

I am a beginner programmer. I have a limited knowledge of javascript, but I have only worked in an IDE. I am currently following Lifehacker's programming series which teaches javascript. I have downloaded Notepad++ and have completed a program, but I am not sure of the steps to run it. In the video, the user is able to just send the program to a browser and the code runs from there.

Here is the video for reference: http://bit.ly/gUsMd3

Thanks! (note: i am a beginner to both programming and this site so any constructive criticism is welcome)

Upvotes: 7

Views: 115191

Answers (4)

aks
aks

Reputation: 526

To run JavaScript with Notepad++,

  1. Type your JavaScript code in Notepad++.
    For instance, type the code
    window.alert("Hello world!");
    in Notepad++.
  2. Now, enclose your code with <script> and </script> tags. The above code now becomes

    <script> window.alert("Hello world!"); </script>

  3. Save the file with a .html extension.

  4. Now, click on Run -> Launch in Chrome. The JavaScript code will be run in the Chrome browser.

  5. If you modify the code, simply save the changes (Ctrl+s) in Notepad++. Then press Alt+Tab to return to Chrome. Press the Refresh button to run the changed code.

Upvotes: 3

Michal
Michal

Reputation: 17

You can also download a console plugin that would allow you to execute java scripts without leaving Notepad++. See this video for reference:

Upvotes: 0

Anvesh_vs
Anvesh_vs

Reputation: 394

Just save the sample code to a file, such as "example.html", and then open that file in a browser.

<html>
<script>
alert("hi");
</script>
</html>

Upvotes: 4

mrbellek
mrbellek

Reputation: 2300

Javascript does not need to be compiled, you can put it between <script> and </script> in a file, save it as something.html and open it in your browser.

Java needs to be compiled, but that is something completely different.

Upvotes: 19

Related Questions