I have question concerning the difference of using in JavaScript code comma
OR semicolon
.
Do they have differences and influence how the code works?
In the code below I changed the semicolon after definition of var fib
that have value 0
by comma an code didn't run.
Can somebody explain this?
The full code of Fibonacci in which it has occurred is here:
<script>
document.write("<h2>Числа Фибоначчи </h2>");
for (i = 0, j = 1, k = 0, fib = 0; i < 50; i++, fib = j + k, j = k, k = fib) {
document.write("Fibonacci (" + i + ") = " + fib);
document.write("<br>");
}
</script>