Q. Which one of the following is the correct output for the given JavaScript code?

Code:
    const object1 ={};  
    a = Symbol('a');  
    b =Symbol.for('b');  
    object1[a]='harry';  
    object1[b]='derry';  
    constobjectSymbols=Object.getOwnPropertySymbols(object1);  
    console.log(objectSymbols.length);  
  • (A) 0
  • (B) 1
  • (C) 2
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 2

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
207
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Indresh Gehalot
Publisher
πŸ“ˆ
81%
Success Rate