Which is the correct JavaScript statement to define string as object?

53. Which is the correct JavaScript statement to define string as object?

  1. var s = new String("IncludeHelp!");
  2. var s = String("IncludeHelp!");
  3. var s = "IncludeHelp!"
  4. 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!");

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.