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(“AngularJS”);
set.add(“Bootstrap”);
set.delete(“Bootstrap”);
document.writeln(set.size);

What will be the output of the following JavaScript code?
set.add(“AngularJS”);
set.add(“Bootstrap”);
set.delete(“Bootstrap”);
document.writeln(set.size);
a) 2
b) 1
c) 0
d) undefined

Answer: b
Explanation: The delete() method is used to remove all the elements from the Set object which are passed as an argument to the delete function. Since the delete function is called once the size will be reduced to 1.

Join The Discussion