displaying NAme | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

displaying NAme

//why does not display Name <!DOCTYPE html> <html> <body> <h1>JavaScript console.log() Method</h1> <p>Press F12 on your keyboard to view the message in the console view.</p> <p>This example demonstrates how an object is displayed in the console view.</p> <script> var myObj = { firsname : "John", lastname : "Doe" }; console.log(myObj); </script> </body> </html> //Somebody can tell why not gives answer for the name to display in this code??

19th Nov 2018, 12:05 AM
Gustave A C/D C ☢️ 🛸♨️🛸🛸
1 Answer
+ 2
Here's the correct code <!DOCTYPE html> <html> <body> <h1>JavaScript console.log() Method</h1> <p>Press F12 on your keyboard to view the message in the console view.</p> <p>This example demonstrates how an object is displayed in the console view.</p> <script> var myObj = { firstname : "John", lastname : "Doe" }; console.log(myObj.firstname+" "+myObj.lastname); </script> </body> </html>
19th Nov 2018, 12:11 AM
Paul
Paul - avatar