Can we call JavaScript as platform independent language?

1k views Asked by At

I searched it on the internet and it says

JavaScript is a simple programming language built into Netscape 2.0 and greater. ... Since the JavaScript interpreter is part of Netscape, it is platform-independent

But if JavaScript platform independent, why does some functionalities work on one browser, but not on the other. It is many times mentioned in the documentation also that this works in the following browser.

2

There are 2 answers

1
capchuck On

JavaScript is realization of the EcmaScript specification.

JavaScript in different browsers has different engines, i.e. implementations. Server-side JavaScript runs on modified Chrome's engine.

What you talking about is the APIs. Filesystem API is NodeJS-specific, DOM-api is specific to browsers. Even console.log is not the part of JavaScript spec, but part of the implementation :)

Also there is an implementations for IoT

So I think we can say that JS is platform independent.

0
Ahamed Safnaj On

JavaScript is a lightweight scripting language based on ECMAScript standards. It executes on the browser and therefore reduces the load on the server. Any JavaScript-enabled browser can understand and interpreted JavaScript code which simply means that you can simply write the script once and run it anywhere and anytime.

Different browsers using different engines to run JavaScripts i.e Chromes' V8, Firefox's SpiderMonkey, Edge's Chakra. In general, you can write your JavaScript applications and run them on any platform or any browser without affecting the output of the Script. Any JavaScript code is executed on different types of hardware a JavaScript program written for.

So wean call it as a platform independent or portable.