0

I've tried for a couple hours to convert the following object to JSON string:

car = {

    go : function(){
        alert('accelerating');
    }

}

When I convert using JSON.stringify(car), it returns {}, because methods won't work with json strings. So I thought there must be some sort of hack for that.

My question is: What is the quickest way to transform this object into a string and then back to an object, keeping its methods?

2

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.