1

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>

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.