when to use array var and when to use json ? code example
Example 1: json example array
{
"name":"John",
"age":30,
"cars":[ "Ford", "BMW", "Fiat" ]
}
// Another exemple
{
"people": [
{
"website": "stackabuse.com",
"from": "Nebraska",
"name": "Scott"
},
{
"website": "google.com",
"from": "US",
"name": "Zuck"
}
]
}
Example 2: hwo to access arary in json
console.log(dataJS);
console.log(dataJS[0].eee1);
console.log(dataJS[0].comments[0]);