Creating a New Object


The program says it completed successfully, but the only thing printed to the console is 21. Kylo Ren is not printed. I tried doing a one-word name with no luck either. Please advise why both are not printing to the console.

var me = new Object(); = "Kylo Ren";
me.age = 21;


HI the CodeCademy console sometime log only the last line if you want to print "Kylo Ren" you should do it like that

console.log(; //this will print Kylo Ren
console.log(me.age); //this 21

Add it after your code.


if you want it to print both values you must console.log the object by its name or both values seperately. :slight_smile:

The reason it brings back 21 is cause it by default will show the last line of your code when no console.log is indicated.


Thank you both.
So, in professional practice, the way I did is correct?
I understand it only prints the last line now. :smiley: