Why it only displays the last value in the console instead of all of them?


#1

Continuing the discussion from Any help appreciated! object is not defined:

I have one more question though. Why it only logs my last value into the console instead of all of them??? Thanks a lot!


#2

Because @devace71301 your not logging anything.. if this were an actual real javascript code editor, the console would have been blank.. Codecademy has troubles on fixing thier console, where that the last thing you type as a string will show up on console if you dont log anything to the console. so for some reason that shows up... Again if this were a real console, it would have been blank. if you want to log something to console just do:

console.log("Hello World");

#3

/*This code down below is just working fine, but it is not printing anything. Can some body tell me why and what should be done? Thanks! :) */

var object1 = {
name: "Kakashi Ung Nuh Ack",
age: "22",
hight: "6.00",
};
var object2 = {
name: "Leoreo",
age: "23",
hight: "6.05",
};
var object3 = {
name: "Tshniy",
age: "19",
hight: "5.00",
};


#4

It is because that you are just storing these properties as objects. If you want to print the objects, just log them into the console using console.log();


#5

oh, okay. Loool! thank you tho