PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You develop an HTML5 application that interacts with a REST service. The REST service accepts JSON data.
A JavaScript object named form Data contains data that is sent to the REST service.
You need to convert the JavaScript object named formData into JSON.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
jQuery.ajax.valueOf(formData);

B.
window.evai(formData);

C.
JSON.stringify (formData);

D.
formData.toString();

Explanation:
JSON.stringify converts a JavaScript value to a JavaScript Object Notation (JSON) string.
JSON.stringify Function (JavaScript)


Leave a Reply