I'm trying to stringify the mousewheel
event using the following function. The function works fine in other instances, but in this instance I'm getting Maximum call stack size exceeded
. How can I make it only return properties/methods to the nth level?
function cloneAsObject(obj) {
if (obj === null || !(obj instanceof Object)) {
return obj;
}
var temp = (obj instanceof Array) ? [] : {};
for (var key in obj) {
temp[key] = cloneAsObject(obj[key]);
}
return temp;
}