I have written code for the Loops 2 skill test two different ways.
One using } else {
and the other using if(i === phonebook.length - 1) {
.
They both seem to effectively do the same thing. But I want to know, can someone tell is there an advantage to one method or the other?
Here are the links:
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Test_your_skills:_Loops