JS Startup

Challenges, Tips & Tricks & Tutorials

JavaScript Quiz – access JSON string value is possible

JavaScript Quiz – access JSON string value is possible

Access JSON String Value

JSON stands for JavaScript Object Notation. JSON property can be access but JSON can also convert to string and access is a value like normal JSON not possible.

JSON.stringfy() method is used to convert JSON object to JSON string. Let’s look for basic syntax of JSON stringfy method.


For more detail about the JSON stringfy method click here.

JavaScript Question

In this javascript quiz, find out does access JSON string value is possible because JSON object property can be access but JSON string value have different case.

First, we declare a variable detail using the let keyword and assign a javascript object to it.

let detail = {name:"JS", last:"startup"};

Now we check the value of property name from detail. We get it’s value “JS”.

console.log(detail.name); // => "JS"

In the next step, we convert JSON object to JSON string using JSON.stringfy() and assign to jsonString variable.

let jsonString = JSON.stringify(detail);

Finally, we are checking the value again and print using console log.


Any idea what should be the value of above code statement.

JavaScript Quiz Test

Here is the full javascript code snippet for you to solve.

let detail = {name:"JS", last:"startup"};

console.log(detail.name); // => "JS"

let jsonString = JSON.stringify(detail);

// output => 🧐 ?

// Made with ❤️, by @jsstartup

Answer – undefined

Click To Run Code


Now you know the answer is undefined. But why does it should give “js” otherwise something else? Let me explain.

So, it’s easy to access the property of JSON object but when you apply JSON stringfy method then then JSON object convert to string.

Let see the value of jsonString


As you can see it’s a simple string and not an object. And access the property of nothing return undefined.

At last, That’s why we get an answer “undefined“.

Let me know in the comment section, what you think about it.

I hope you understand the concept and logic behind it.

But wait, i have something more for you –

Check out our other javascript quiz – 

  1. JS Quiz – what does triple value compare 10 > 9 > 8 return
  2. JavaScript Quiz – does it shift array element to the right
  3. JavaScript Quiz – does false compare with false return false
  4. JS Quiz – can array have the size method like a set


To participate in our javascript quiz or challenges, tutorial, tips & tricks make sure to join our jsstartup newsletter. So, you can able to participate in our daily challenges & learn the javascript concept.

And last but not the least, don’t forget to like, comment and share. It gives us a morale boost to remain to continue. Also, join our Facebook Page

If you have any questions, please feel free to ask me in the comment section and also let me know if you have any suggestions. As suggestions are always welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top
Share via
Copy link