处理JSON:function traverseJSON(obj, arr) {for (var key in obj) {if (typeof obj[key] === 'string') {arr.push(obj[key]);} else if (typeof obj[key] === 'object') {traverseJSON(obj[key], arr);}}
}traverseJSON({}, [])遍历数组查找下标:
function compareArrays(arr1, arr2) {var diff = [];for (var i = 0; i < arr1.length; i++) {if (arr1[i] !== arr2[i]) {diff.push(i);}}return diff;
}compareArrays([], [])