name ="hi"//ES6var a = {});//ES5var a = {};a[name] = value;
More complex example
var i =0;var a = {};console.log(a.foo1); // 1console.log(a.foo2); // 2
Arrow functions
Preserves this function
e => {}
Template Literals
bio =`${name} is ${emotion}`
Tag Functions
var person ='Mike';var age =28;functionmyTag(strings, personExp, ageExp) {var str0 = strings[0]; // "That "var str1 = strings[1]; // " is a "// There is technically a string after// the final expression (in our example),// but it is empty (""), so disregard.// var str2 = strings[2];var ageStr;if (ageExp >99){ ageStr ='centenarian'; } else { ageStr ='youngster'; }// We can even return a string built using a template literalreturn`${str0}${personExp}${str1}${ageStr}`;}var output =myTag`That ${ person } is a ${ age }`;console.log(output);// That Mike is a youngster
EMCA 2020
Optional Chaining
For use when you are accessing an object deeply and arent sure about key existence