LearnFrenzy
Sign in Take a free test

Strings · JavaScript Strings MCQ · Question 9

new String("hi") Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 9 Back to Exercise

Which statement about new String("hi") is true?

  • A It is identical to the primitive "hi"
  • B It throws a TypeError
  • C It is an object: typeof gives "object" and it is not === "hi" Correct
  • D It creates an array of characters
Correct Answer: Option C

Wrapper objects compare by reference and are always truthy (even new String("")). Use primitive strings; call String() without new to convert.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links