a question regarding loops in javascript
why is that when we create a loop for example
let friendsInTheOffice = 0;
while(friendsInTheOffice < 10) {
console.log(friendsInTheOffice) // if we.console log here we get the result 9
friendsInTheOffice++
}
console.log(friendsInTheOffice) // however if we console.log here we get the result 10
if someone can provide me with a in-depth explonation i'd really appreciate it, a.k.a i am new at learning JavaScript.
let friendsInTheOffice = 0;
while(friendsInTheOffice < 10) {
console.log(friendsInTheOffice) // if we.console log here we get the result 9
friendsInTheOffice++
}
console.log(friendsInTheOffice) // however if we console.log here we get the result 10
if someone can provide me with a in-depth explonation i'd really appreciate it, a.k.a i am new at learning JavaScript.
