功能: var fruitArry=[{name:'durian'},{name:'peach'},{name:'banana'},{name:'pitaya'},{name:'apple'},{name:'cherry'}]; var fruit={'banana':'香蕉','peach':'桃子','durian':'榴莲','pitaya':'火龙果'}; 将 fruitArry 中 name 的值根据 fruit 的 key 值进行替换:如果 fruitArry 的…
Array.prototype.indexOf = function (val) {//判断数组是否存在某个值,如果存在返回该值对应的索引,否则返回-1 for (var i = 0; i < this.length; i++) { if(typeof val === 'object' && typeof this[i]==='object'){ var str1 = JSON.stringify(val); var str2 = JSON.stringify(this[i]); i…