I have the following code:
http://jsfiddle.net/8tAyu/7/
var foo = {
"foundation": "Mozilla",
"model": "box",
"week": 45,
"transport": {
"week": 3
},
"month": 7
};
console.log(JSON.stringify(foo,
function(k, v) {
if (k === "week")
return v;
else
return undefined;
}));
so presumably, I thought that at least the “week” that is not invested should return, and I will see how to return the invested in it too. But no matter how I change it, it console.logdisplays undefined, if only I do not change the function just return vforever, then I return the whole object. Why is this?
source
share