Does JavaScipt program have to be executed by the interpreter of browser inside?

  node.js, question

As a beginner of JavaScript, there is a big and silly question: Do JavaScipt programs have to be executed with the interpreter of browser inside?

We know that for dynamic languages such as Ruby and Python, it is only necessary to open their interpreters at the terminal inside, or to put the code in the file inside to execute. But js is different. What I know is, write a. js file, then introduce it into an html file inside, and then execute it. Or just put js code in html file inside. However, is this not annoying?

(of course, node.js is different and can be executed directly by “node example.js” However, some code cannot be executed in node inside, for example, the alert () function cannot be found. )

Can writing js code be like writing Ruby or Python? Can it be executed in the file inside or interactively without writing some html code?

There is one question to consider first: why use JS? Why is js introduced into html?

In fact, js is used in many cases to do DOM-related (but from the perspective of js in the Web standard, not from the perspective of JS language), then it should be combined with HTML. This may not be the same as node.js or python or ruby. If you just want to execute js code for learning, it is recommended to use the console in Firefox firebug.

From the perspective of javascript language, it can actually be used alone, just because it has been used in the web for a long time. However, the appearance of node.js seems to have brought a turning point.

Reference link: … … …