Type Your Code Here

// Create an empty object const object1 = {}; // Create a unique symbol 'a' const a = Symbol('a'); // Retrieve or create a symbol with key 'b' in the global symbol registry const b = Symbol.for('b'); // Assign 'localSymbol' to the property keyed by symbol 'a' object1[a] = 'localSymbol'; // Assign 'globalSymbol' to the property keyed by symbol 'b' object1[b] = 'globalSymbol'; // Create an empty object const object2 = {}; // Create a unique symbol 'c' const c = Symbol('c'); // Assign 'Carry' to the property keyed by symbol 'c' in object2 object2[c] = 'Carry'; // Get an array of symbols belonging to object1 const objectSymbols = Object.getOwnPropertySymbols(object1); // Output the length of the array containing symbols console.log(objectSymbols.length);

Output: