How to do it...

  1. Open your command-line application and navigate to your workspace.
  2. Create a new folder named 11-01-local-symbols.
  3. Copy or create an index.html that loads and runs a main function from main.js.
  1. Create a main.js file that defines a main function that creates a couple of sets of symbols using the same arguments. Print out their equality as follows:
// main.js export function main() {    const usLaunchLocation = Symbol.for('Kennedy Space Center');    const duplicateLaunchLocation = Symbol.for('Kennedy Space     Center');    console.log(usLaunchLocation, duplicateLaunchLocation);    console.log('Identical launch locations: ', usLaunchLocation     === duplicateLaunchLocation);    const rocketNumber = Symbol.for(5); const duplicateRocketNumber = ...

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.