0

Been writing code in Javascript for a couple of months, but always inside pages such as CodeAcademy or Udacity, with their own command line.

And now trying my code directly on a text editor I have a very main question. Why does the text in console.log don't show up in the browswer? I'm attaching here a very basic example to see if I'm doing something wrong.

<!DOCTYPE html>
<html>
   <head>

    <title>Triangles</title>
    <meta = charset=utf-8>

</head>

<body>

    <script>

        var titulo = "w3resource";


    </script>

</body>

</html>

Appreciate it! Thanks,

Jaime

1
  • 2
    I can't see any to call of console.log Commented Mar 22, 2015 at 13:02

3 Answers 3

1

You need to first print to the console using

console.log(titulo);

Then, open the console/developers-tools of your browser to see all outputs

Chrome: Wrench Menu > Tools > JavaScript Console

FireFox: Tools > Web Developer > Web Console
Sign up to request clarification or add additional context in comments.

2 Comments

or just press F12 (in chrome) :)
@RobinHellemans F12 only works in windows. For chrome on mac, it's command-option-I, ditto for Firefox on mac
0

you are only declaring variable, try logging your variable using console.log

try this

console.log(titulo)

Comments

0

You will need to show the console. F12 to show developer tools then choose console to see your output with a call to console.log.

There are also other uses/calls for console - see chrome api here https://developer.chrome.com/devtools/docs/console-api

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.