Arrow functions:
// ES5
function sayHello (name) {
return 'Hello ' + name
}
// ES6
const sayHello = (name) => 'Hello ' + name
console.log(sayHello('Ramesh'))
Variables:
var firstName = 'Ramesh'; // ES5
let firstName = 'Ramesh' // ES6 - have block scope
const firstName = 'Ramesh' // ES6 - as it says, it's a constant
Template Strings:
let strWelcome = 'Welcome'
// use the backticks to combine strings with variables
let templateString = `${strWelcome} Ramesh`
console.log(templateString)
async await:
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Async_await
Destructuring:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
Shorthand objects
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer
Function arguments
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments
Expand arrays
https://www.smashingmagazine.com/2016/07/how-to-use-arguments-and-parameters-in-ecmascript-6/
let myArray = [1,2,3]
Math.max(...myArray)
Classes
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/class
No comments:
Post a Comment