Working with JavaScript Symbols

Easy
3
43.5% Acceptance

In this lab, you will learn how to create and use JavaScript Symbols. Symbols are a unique primitive data type that allow you to create non-string property keys. They can be used as identifiers for object properties, ensuring that the properties do not accidentally conflict with other properties.

Tasks:

  1. Create a symbol and store it in a variable named symbolExample.
  2. Create an object called myObject and set a property key using the created symbol.
  3. Create a function named getOwnPropertySymbols that takes an object as argument and returns an array containing the Symbol property keys of that object.