+ 4
Why dosen't the variables work for me?
I was trying to code a simple coding tutorial then I set a variable, the variable wasn't displayed
5 Antworten
+ 2
Try:
var x = 45;
alert(x);
Note that document.write(x) will be written to the console, which isn't always easy to see, whereas the alert function is clearer, as it displays a popup dialog to display some text, or in this case the value of x.
+ 5
Can you post the code here so we can figure out why it's not working? Then we can help you fix it.
+ 2
...
+ 1
var x = 45;
document.write(x);
here
0
the best way to see your variable value is to take the return of your function store it in a variable and log it to the console