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
5 Réponses
+ 9
There shouldn't be a problem with the existing sample you provided. Can you link us to your code?
+ 2
What does 'brackets' (the software, it's not obvious in your question ^^) said about the error raised?
+ 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...
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;
0
so why bracket see it as an error ?