🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Browser Storage and Cookies: all 10 questions

Quiz: Browser Storage and Cookies · Question 4 of 10

What does this print? (code)

What does this print?

console.log(String({ name: "Asha" }));
  1. A.{"name":"Asha"}
  2. B.Asha
  3. C.[object Object]
  4. D.undefined
Answer & explanation

Correct answer: [object Object]

Without JSON.stringify, an object turns into the text [object Object], which is why localStorage needs JSON for objects.

Can you get the rest right without peeking?

Take the timed Quiz: Browser Storage and Cookies quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →