新手:JavaScript VS Node JS [英] newbie: JavaScript VS Node JS
问题描述
如果在浏览器中加载并执行了JavaScript文件,服务器如何知道该文件何时是节点js文件,从而在服务器上执行?
If JavaScript files are loaded and executed in the browser how does the server know when the file is a node js file, therefore to execute on the server?
推荐答案
JavaScript是一种语言.node.js不是语言,而是环境/软件集".运行普通的JavaScript.
JavaScript is a language. node.js is not a language but an "environement/set of software" that runs normal JavaScript.
所有浏览器都具有运行网页JavaScript的JavaScript引擎(用于Firefox的Spidermonkey,用于Chrome的V8).
All browsers have JavaScript engines that run the JavaScript of web pages (Spidermonkey for Firefox, V8 for Chrome).
Node.js只是V8引擎,捆绑了一些库以进行I/O和联网,因此您可以在浏览器之外使用JavaScript(例如,创建后端服务).
Node.js is simply the V8 engine bundled with some libraries to do I/O and networking, so that you can use JavaScript outside of the browser (e.g, to create backend services).
这篇关于新手:JavaScript VS Node JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!