我有一个数组
var array [] //my array
如何以这种格式解析我的数组
array[key] ="array[value]", array[key] ="array[value]"
然后在经过上面的解析数组
之后扭曲[shortcode] [/shortcode]
这是我的数组
答案 0 :(得分:1)
var myArray = ["wheel","good","banana","fruit"];
function parseArray(array){
for(i=0;i<array.length;i++){
array[i] = i+" = array["+array[i]+"]"
}
}
parseArray(myArray);
console.log(array) //it outputs 0 = array["wheel"], 1 = array["good"], etc