That the Promise
API was just recently added to the javascript core has nothing to do with node. It's just part of the language development itself.
Javascript started out as a simple script language to manipulate the Browser DOM. It was developed in 95 by Brendan Eich within 2 weeks. This means, most of the features you have today, where not present. E.g. XMLHTTPRequest
, the core of every modern website was not introduced until 2000. And at that time a lot of people still considered javascript a nice gimmick to create some flashy text effects, but not a serious tool to do (web) development.
After the dust of the browser war settled and javascript was triumphant over flash and java, vendors agreed that they should actually work together and there need to be strict web standards for all browsers to adhere to and the standardization of all web technologies (HTML,CSS,EcmaScript) gained a massive boost. With that, javascript gained a lot of new features.
With the success of javascript people started thinking "Why only use javascript for client side scripting?" - so in 2009 Ryan Dahl created Node.js, a JavaScript run-time environment for executing JavaScript code server-side.
This means, at their core "browser javascript" and "nodejs" both actually base on ECMAScript and run on the same principle of single threaded asynchronous execution. Both have the option to spawn worker threads. Basic functionality like setTimeout
is pretty much the same in browsers and node.
However, the browsers have custom objects to take care of rendering the web page and interacting with the user and are very strictly sandboxed, while node has all the APIs necessary for a server side language (e.g. extensive file access) that would essentially pose security risks if they where present in a browser.