0
To define the first element of an array, in this case cars[0] you first need to declare the array cars = []; or cars = new Array();.
var cars = [];
cars[0] = {
a: "Saab",
b: "Volvo",
c: "BMW"
}
console.log(cars);
var cars2 = new Array();
cars2[0] = {
a: "Saab",
b: "Volvo",
c: "BMW"
}
console.log(cars2);




you have not declared that the object is an array
– Victor