А мне нужно получить только… Как этого добиться?
x = {...}
y = JSON.parse(JSON.stringify(x))
if ( !Array.prototype.forEach ) {
Array.prototype.forEach = function(fn, scope) {
for(var i = 0, len = this.length; i < len; ++i) {
fn.call(scope, this[i], i, this);
}
}
}
[1,2,3].forEach(function(element, index, array) {
console.log("a[" + index + "] = " + element);
});
function fname(args) {
...
}
var fname = function(args) {
…
}
// либо
var fname = new Function(fbody, args)