Why the undefined is coming? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why the undefined is coming?

Code : var aakash = { hair: "green", age: 14, stomach: 'full', eat: function(){ document.write('It is tasty'); } }; document.write(aakash.eat() ) ;

19th Jun 2017, 10:09 AM
Aakash Basnet
Aakash Basnet - avatar
2 Answers
+ 14
Replace last "document.write(aakash.eat())" with just "aakash.eat()"....
19th Jun 2017, 10:18 AM
Valen.H. ~
Valen.H. ~ - avatar
0
Thanks!
22nd Jun 2017, 11:25 AM
Aakash Basnet
Aakash Basnet - avatar