JAVASCRIPT AND CREATING WEB PAGE - Practice Mode

1) How will javascript treat a number, when it is enclosed with double or single quotes?
Correct Answer: String
2) What will be the output for the following JavaScript code?
var x = 13 +'03'
Alert(x);
Correct Answer: 1303
Explanation:

The output of this code will be the string "1303". In JavaScript, when a number and a string are added together using the "+" operator, JavaScript will convert the number to a string and concatenate the two values together. So, the number 13 is converted to the string "13" and then concatenated with the string "03" to form the final string value "1303".

3) What will be the output, if the javascript code is executed
var x = 1324;
var y = new Number(1324);
if( x === y)
alert('Yes');
else
alert('No')
Correct Answer: Yes
4) What is the output of the following JavaScript code?
var x = 'ITI';
var y = 'GOVT';
var o = y concat(x)
document.write(o);
Correct Answer: GOVTITI
5) What is the output of the following javascript code?
var name = 'Kanya Kumari' ;
var x = name.substr(8,2);
document.write(x);
Correct Answer: ma