+1 vote
in JavaScript by (19.9k points)
Which one of the following is the correct output for the given JavaScript code?

const object1 ={};  

a = Symbol('a');  

b =Symbol.for('b');  





a) 0

b) 1

c) 2

d) Error

1 Answer

0 votes
by (23.1k points)

Answer: C

Reason: The method "Object.getOwnPropertySymbols()" used in the above program, returns a whole array of symbol properties, that are directly found on an object. In general, it returns an empty array, unless we have already set symbol properties on the object.

Related questions