Home > Web Front-end > JS Tutorial > Example code sharing of saving the returned object to a two-dimensional array

Example code sharing of saving the returned object to a two-dimensional array

零下一度
Release: 2017-06-26 13:26:28
Original
1233 people have browsed it
var result={"a":{"x":5,"y":0,"z":0},"b":{"x":0,"y":0,"z":3},"c":{"x":5,"y":0,"z":0},"d":{"x":0,"y":0,"z":4},"e":{"x":0,"y":3,"z":0}
};var arr=[];var obj={
    keyArr:['dec'],
    one:['x'],
    two:['y'],
    three:['z']
};for(var key in result){
    obj.keyArr.push(key);var thisResult=result[key];
    obj.one.push(thisResult.x);
    obj.two.push(thisResult.y);
    obj.three.push(thisResult.z);
}//obj.one.unshift("x");//obj.two.unshift("y");//obj.three.unshift("z");for(var i in obj){
    arr.push(obj[i]);
}
console.log(arr);
Copy after login

 

The above is the detailed content of Example code sharing of saving the returned object to a two-dimensional array. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template