最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How can I run JavaScript in Notepad++ without using HTML? - Stack Overflow

programmeradmin1浏览0评论

I'd like to run Javascript Code in Notepad++ without HTML.
I already tried to use NppExec (plugin) but it didn't work.
Is there another plugin that i can use?

Example Code:

var A = 1
var B = 2
var C = A + B

alert(C);

I'd like to run Javascript Code in Notepad++ without HTML.
I already tried to use NppExec (plugin) but it didn't work.
Is there another plugin that i can use?

Example Code:

var A = 1
var B = 2
var C = A + B

alert(C);
Share Improve this question asked Mar 4, 2017 at 17:00 Berny23Berny23 3381 gold badge4 silver badges10 bronze badges 1
  • @EatPeanutButter the syntax is valid in JavaScript. However it is seen as a good practice to end all your statement with semicolons. – Abhishek Gupta Commented Mar 4, 2017 at 17:05
Add a ment  | 

4 Answers 4

Reset to default 6

To run JavaScript you need a runtime environment. This is generally provided by your browser.

You can use Node, to run javascript without browsers.

Some observations :

  • You forgot to add ; in the end of statements.
  • As JavaScript is an interpreted language, not a piled language. So, you can put your JavaScript code inside <script> & </script> tag and Run/Open it in the browser.

    <script> 
        var A = 1
        var B = 2
        var C = A + B
    
        alert(C); // 3
    </script>
    

You forgot to put ; in it

You need a runtime environment to run it but it should be provided by your browser

cscript.exe filename.js

runs JS locally on a Windows with access to things like

FileSystem = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
发布评论

评论列表(0)

  1. 暂无评论