Which method is used to convert JSON data to a JavaScript object?

Which method is used to convert JSON data to a JavaScript object?

a) JSON.parse()
b) JSON.stringify()
c) Object.assign()
d) Array.from()

Answer:

a) JSON.parse()

Explanation:

The JSON.parse() method is used to convert a JSON string into a JavaScript object. This is commonly used when receiving JSON data from an API or another external source.

Reference:

JavaScript MCQ (Multiple-Choice Questions)

Leave a Comment

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

Scroll to Top