Reputation: 29
When I open up the following file with my firefox browser, nothing is outputted on my screen. What am I doing wrong?
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<script>
var mystring="hello world";
console.log(mystring);
</script>
</head>
<body>
</body>
</html>
Upvotes: 1
Views: 41
Reputation: 6826
console.log()
does not write on the webpage (for that you need document.write("your text here")
.
To view that text, make sure you enable and open "Developer tools" in firefox and go to the "console" tab. Refresh the page and you will see the text there!
For more info, please read https://developer.mozilla.org/en-US/docs/Web/API/Console/log
This might help you also: https://developer.mozilla.org/en-US/docs/Tools/Web_Console
Upvotes: 3