+ 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 ☢️ 🛸🛸🛸
Gustave A C/D C ☢️ 🛸🛸🛸 - avatar
1 Respuesta
+ 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