Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following JavaScript code?
set.add(“one”);
set.add(“two”);
var itr=set.values();
document.writeln(itr.next().value);

What will be the output of the following JavaScript code?
set.add(“one”);
set.add(“two”);
var itr=set.values();
document.writeln(itr.next().value);
a) one
b) Two
c) error
d) undefined

Answer: a
Explanation: values() method returns an object of new Set iterator. This object contains the value for each element. It maintains insertion order.

Join The Discussion