I have a query. I'm looking at Javascript in React Native and I have the output of a variable in this form, Code N1 but I want the output of the variable to be Code N2 , I don't know how to convert two objects that are the console.log of my variable in an Array of objects. Thank you very much in advance.
Code N 1
Object {
"city": "",
"year": "",
}
Object {
"city": "",
"year": "",
}
Code N 2
Array [
Object {
"city": "",
"year": "",
},
Object {
"hour": "",
"year": "",
},
]
try like this.
function abc(){
var z = []
var abc= {
"city": "",
"year": "",
}
var def= {
"city": "",
"year": "",
}
z.push(abc);
z.push(def);
console.log(z);
}
abc();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.