What is the output of below Javascript code?

function check_value()
{
var value = new Boolean(1);
alert(String(value));
}

 Posted by vishalneeraj-24503 on 12/19/2013 | Category: JavaScript Interview questions | Views: 923 | Points: 40
Answer:

Output will be "true".

As we know that,Boolean data-type takes only True and False value.

The String() function converts the value of an object to a string.

and also true = 1 and false = 0 that's why it will return true.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response