Home »
MCQs »
JavaScript MCQs
Which is the correct JavaScript statement to define string as object?
53. Which is the correct JavaScript statement to define string as object?
- var s = new String("IncludeHelp!");
- var s = String("IncludeHelp!");
- var s = "IncludeHelp!"
- All of the above
Answer: A) var s = new String("IncludeHelp!");
Explanation:
The strings can also be defined as an object using the new keyword. The correct JavaScript statement to define a string as an object is:
var s = new String("IncludeHelp!");