DEV Community

Cover image for Pioneer of JavaScript
Kueiapp
Kueiapp

Posted on

Pioneer of JavaScript

Reference

http://blog.kueiapp.com/en/programming/talk-about-javascript/

JavaScript 1.0

The JavaScript 1.0 was made by Brendan Eich, Netscape company for a famous browser called Netscape in 1995. Java was a very popular language that age, so Netscape wanted to be cool like that, and named it JavaScript. However, they are completely without relations.

Microsoft, published two languages that could be run in browsers, VBScript and JScript in 1996. JScript was actually a clone of JavaScript for Internet Explorer 3.

In order to make a standard for JavaScript, Netscape proposed the first standard to ECMA International in 1996, and be first draft of in 1997. They called it ECMAScript which is a global standard for JavaScript. From now on in 2022, the most popular version is ECMAScript 2015 ( also called ES6 ) with the most browsers supports.

With different version of JavaScript, it comes with different syntax, functions, libraries, or module systems. To check if our environment can run it or not, caniuse.com is a fantastic website for web information.

ESMAScript (JavaScript) candidate list

  1. 5th edition: ES5
  2. ES6 – ECMAScript 2015
  3. ES7 – ECMAScript 2016
  4. ES8 – ECMAScript 2017
  5. ES9 – ECMAScript 2018

NodeJS

Image description

2008, Google published its browser Chrome and V8 rendering-engine for JavaScript threw a big bomb for web world. Because of one feature of V8 – Open Source, the engine was modified by NodeJS team and be made to handle web application to building up a server lightly.

JavaScript module

Because of NodeJS, the application of JavaScript is not only for browsers but also service provider at server-side. Coding styles are also not be limited by web page, module programming was brought in the JavaScript world by many NodeJS applications.

require vs import

When talk about module, it usually contain a class or a set of functions used for a purpose. Besides, because JavaScript world is a free and open platform, there are several styles of Module in JavaScript.

  1. CommonJS
  2. UMD — Universal Module Definition
  3. AMD
  4. Require.js
  5. Es6 module

When time goes by, we can summarize them to both import and require styles when using JavaScript Module.

require
The require was established earlier and be used commonly in NodeJS with CommonJS style.

// a.js
const module = require('module');
module.hello()

// module.js
function hello(){ console.log('hello') }
module.exports = { hello }
Enter fullscreen mode Exit fullscreen mode

import

In the latest ES6 standard, module could be written as import and export, and it looks much easier to be understood

// a.js
import module from "module"
module.hello()
// or
import { hello } from "module|

// module.js
export function hello(){ console.log('hello') }
// or
export { hello }
Enter fullscreen mode Exit fullscreen mode

Use NodeJS

NodeJS is a independent runtime environment. There are two ways to install, then we can use node to run our JavaScript codes in terminal.

  1. Download an install from nodejs.org
  2. Install from Package management system, such as HomeBrew in macOS brew install node
node hello.js

// or omit the extension
node hello
Enter fullscreen mode Exit fullscreen mode

Reference

http://blog.kueiapp.com/en/programming/talk-about-javascript/

Top comments (0)