flyingfish7100
flyingfish7100

Reputation: 9

How to see output in the console if the input is from web in WebStorm

I am running scripts in the Webstorm. I have two files, one is index.html and another one is script.js. I am running index.html. I can input the name from the prompt window form and see the output from alert. But how can I see the output in the console?

Index.html

<!DOCTYPE html>
<html>
<head>
    <title>Script Demo</title>

</head>
<body>
<h1>Including JS Files</h1>
<script src="script.js"></script>
</body>
</html>

script.js

var userName = prompt("What is your name?");
alert("Nice to meet you, " + userName);
console.log("Also great to meet you, " + userName);

The console.log supposed to print out "Also great to meet you" + userName. But I cannot see it in the WebStorm console. How does this work? Thanks!

Upvotes: 0

Views: 59

Answers (1)

lena
lena

Reputation: 93728

Try running your code in debugger (right-click your index.html and choose Debug) - output from console.log will be shown in debugger console

enter image description here

Upvotes: 1

Related Questions