Skip to main content

Writing into the browser console, using console.log() in JAVA SCRIPT

Using console.log()
For debugging purposes, you can use the console.log() method to display data.
Different types of way how to define console.log() method in program.
CODING:
<!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);//("String") or ((45+7)*(47-34)) or (arrayname)
</script>
</body>
</html>

Comments