Professional Documents
Culture Documents
js
https://nodejs.org
install Create-React-App
create-react-app demo-project
npm start
console.log('hello world');
// 5 is assigned to variable x
let x = 5;
console.log(x); // 5
x = 3;
console.log(x); // 3
const x = 5;
JavaScript console.log()
// storing values
Assignment Operators
Arithmetic Operators
Comparison Operators
Logical Operators
Bitwise Operators
String Operators
Other Operators
let x = 5;
let y = 3;
// addition
// subtraction
// multiplication
// division
// remainder
// decrement
//exponentiation
console.log('x ** y =', x ** y);
ECMAScript 6
The next big update occurred in 2015 when ECMAScript 6
(ES6) or ECMAScript 2015 (ES2015) was officially released. ES6
features modernized JavaScript.
And beyond
There have been four more updates since that time: ECMAScript
2016, 2017, 2018, and 2019. The name ES.Next is given to the
upcoming version, which is still in revision and proposal.
JavaScript let
console.log(name); // Peter
}
console.log(name); // Sara
JavaScript const
// function expression
let x = function(x, y) {
return x * y;
}
// function expression using arrow function
let x = (x, y) => x * y;
JavaScript Classes
class Person {
constructor(name) {
this.name = name;
}
}
class Person {
constructor(name) {
this.name = name;
}
}
console.log(person1.name); // John
In the ES6 version, you can pass default values in the function
parameters. For example,
function sum(x, y = 5) {
// take sum
// the value of y is 5 if not passed
console.log(x + y);
}
sum(5); // 10
sum(5, 15); // 20