I have a JSON , for example:
var text = '{"name":"John Johnson","street":"Oslo West 16","phone":"555 1234567"}';
And I want to insert it inside a closure in JavaScript , but read the JSON from outside the closure , I can not read it from the outside.
var add = (function () {
var counter = 0;
return function () {
return var text = '{"name":"John Johnson","street":"Oslo West 16","phone":"555 1234567"}';
}
})();
It's an example, even after parsing it I can not get the JSON data, or modify it. Any help?