+ 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

15th Apr 2018, 1:04 AM
Supergrupgr
Supergrupgr - avatar
5 ответов
+ 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.
15th Apr 2018, 4:02 AM
Emma
+ 5
Can you post the code here so we can figure out why it's not working? Then we can help you fix it.
15th Apr 2018, 1:22 AM
synorax
synorax - avatar
+ 2
...
15th Apr 2018, 1:04 AM
Supergrupgr
Supergrupgr - avatar
+ 1
var x = 45; document.write(x); here
15th Apr 2018, 2:10 AM
Supergrupgr
Supergrupgr - avatar
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
26th Jun 2018, 3:54 PM
Adnen Rebai
Adnen Rebai - avatar