+ 1
Best way to solve a logic error?
........
3 Answers
+ 3
console.log all variables that are kind of important or that might be off.
make sure to mark which value is what like this:
console.log("x: " + x + ", y: " + y);
+ 2
Ultimately, it depends upon what you're trying to do. If your logic is flawed in how you're thinking about or dealing with the problem, then you need to correct your understanding of the problem first. For example, if you think 2+2 is 7 then you'll never understand why you're getting 4 until you learn more. Get what I mean?
What's the exact problem that you're having? It'll be much easier for us to help you with that. Over time your logic/problem-solving skills typically get better, but of course, some people are naturally better at it than others.
+ 1
In java it's System.out.println instead of console.log
(just in case...)