I am working on the below JS and it won't show an output when loaded.
<html>
<head>
</head>
<body>
<script type="text/javascript">
var MAX = 3;
function structCars() {
this.make;
this.model;
this.color;
}
var cars = new Array();
var makes = new Array (
"Toyota",
"Ford",
"Chevrolet"
);
var models = new Array (
"Camrey",
"Mustang",
"Nova"
);
var colors = new Array (
"Blue",
"Red",
"Yellow"
);
for(var i = 0; i < MAX; i++) {
var temp = new structCars();
temp.make = makes[i];
temp.model = models[i];
temp.color = colors[i];
cars.push(temp);
}
for(i = 0; i < cars.length(); i++) {
document.write(i + " " + cars[i].make + ", " + cars[i].model + ", " + cars[i].color + ".<br>");
}
</script>
</body>
</html>
The output should be something like:
0 Toyota, Camry, Blue
1 Ford, Mustang, Red
2 Chevrolet, Nova, Yellow
But nothing is coming up. This could be something simple, or I am doing this totally wrong. I am starting to learn JavaScript, and this is driving me crazy trying to figure this out..
This is for an online coding assignment and I don't want someone to do my work for me. I have asked my professor, but he is only proficient in C#/Java and not JS.... thanks prof..
Thank you for any and all support.
John