0

Why when I wrote variables in js it give me an error in bracket ?

when I'm trying to write variable like this var x = 10, y = 20, z = 100; did I write something wrong

25th Jul 2017, 9:42 AM
Hosam Gamal
Hosam Gamal - avatar
5 Respuestas
+ 9
There shouldn't be a problem with the existing sample you provided. Can you link us to your code?
25th Jul 2017, 9:52 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
What does 'brackets' (the software, it's not obvious in your question ^^) said about the error raised?
25th Jul 2017, 11:41 AM
visph
visph - avatar
+ 1
I wrote this code just to try: <!DOCTYPE html> <html> <head> <title> Page </title> </head> <body> <button onclick="b();">click me</button> <script> function b() { var x = 10, y = 20, z = 100; alert(x+z); } </script> </body> </html> I opened it using chrome and it gives me no problem...
25th Jul 2017, 9:57 AM
2_3rr0r5
2_3rr0r5 - avatar
0
thank you for your answer and the problem is solved when I write the code this way var x = 10, y = 20, z = 100;
25th Jul 2017, 9:54 AM
Hosam Gamal
Hosam Gamal - avatar
0
so why bracket see it as an error ?
25th Jul 2017, 9:58 AM
Hosam Gamal
Hosam Gamal - avatar