Question

JavaScript Write a function named "to_json" that takes any valid type as a parameter and returns...

JavaScript

Write a function named "to_json" that takes any valid type as a parameter and returns the input as a JSON formatted string. For example, if the input is a key-value store this function should return a JSON string representing an object containing the same data

0 0
Add a comment Improve this question Transcribed image text
Answer #1

function to_Json(var toJSON){

return JSON.stringify(toJSON);

}

this function when called with any argument will return the argument to a JSON String and will return that from function.

Add a comment
Know the answer?
Add Answer to:
JavaScript Write a function named "to_json" that takes any valid type as a parameter and returns...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT