Is “Javascript” also a server side language? [closed]

白昼怎懂夜的黑 提交于 2021-01-20 13:39:40

问题


Few year back I read on some websites that "JavaScript is only a client-sided language".

is it so? if not then why?


回答1:


Eventhough JavaScript was first developed to be used in a browser, the language itself has never been a strict client side language.

Aside from a few string methods that create HTML tags, there is nothing in the language itself that is specific to client side programming. Everything related to the browser is in the DOM, not in the JavaScript language.

JavaScript is used in client side scripting (and that use is almost analogous to client side scripting), but branding it a client side language would be misleading. The fact that the language itself doesn't contain the browser integration has made it easy to adapt it to other environments, including server side scripting.

Node.js is far from the only server side scripting using JavaScript. ASP for example offered VBScript and JScript (Microsofts implementation of JavaScript) as server side languages. This list compares 28 different server side uses, and it's not all there is.




回答2:


Remember that JavaScript was some day Netscape LiveScript and it was already a client and server programming language. In fact, ASP Classic could be developed using JScript (basically, old JavaScript).

A language turns into a server-side language once it can be used to develop back-end code, and yes, JavaScript has been always a player in the server development.

Now with NodeJS, JavaScript has been turned into a possible and serious language of choice to develop backends.



来源:https://stackoverflow.com/questions/32759404/is-javascript-also-a-server-side-language

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!