for( let i = 1 ; j < 13 ; i++ ) {
for( let i = 1 ; j < 13 ; j++) {
console.log(`${j} multiplied by ${i} is ${i*j}`);
}
}
I’m going through a book trying to learn some Javascript. This is the code I enter but it won’t work, just get a lot of error messages, Would love some help!!
Hi, and thanks. I’ve worked with loops before though it’s been a while. This came from a book so I just assumed it was right. So the loop is working but the output isn’t quite right. Instead of numbers I"m seeing
Start developing the habit of never using j as a variable. When you need a single letter variable, stick to using k, n, etc. Basically, letters that don’t look similar and can’t be confused with one another.
When developers use j mixed in their loops, this is actually a pretty common mistake so it’s best to just not use it. Since i stands for iterator, so it stays.
Ah, thanks. I had a look to see if backticks might be causing an issue simply by not being quotes, but didn’t pursue past the end of the console documentation.
Could it be a browser problem? What browser are you using @trctvb ?