Symbol
Symbol is a type of primitive data type intriduced in ES6. It is used to specify the hidden identifiers that can not be directly accessed by any other code.
Example: The use of the Symbol data type is explained in the below code example.
Javascript
const gfg = { name: "w3wiki" , desc: "A Computer Science portal for all geeks." } let short_name = Symbol( "short_name" ) gfg.short_name = "GFG" ; console.log(`${gfg.name}, \n${gfg.desc}`); console.log(`Company 's Short Name using gfg.short_name: ${gfg.short_name} `) console.log(`Company' s Short Name using gfg[short_name]: ${gfg[short_name]} `) |
Output
w3wiki, A Computer Science portal for all geeks. Company's Short Name using gfg.short_name: GFG Company's Short Name using gfg[short_name]: undefined
Introduction to ES6
ES6 or ECMAScript 2015 is the 6th version of the ECMAScript programming language. ECMAScript is the standardization of Javascript which was released in 2015 and subsequently renamed as ECMAScript 2015.
ECMAScript and Javascript are both different.