I’ve been always confused at the time to choose between the for and while loop.
In which situations should I use ‘while loops’ instead’ for loops’ in JavaScript? Does it make a difference?
I’ve been always confused at the time to choose between the for and while
Share
In terms of “what works”, they’re interchangeable.
In terms of best practices and conventions, for loops are for a known number of iterations and while loops are to be executed until their intended job is done.