Im no expert, but const is not changeable once it is declared, so if it is declared in the scope of the whole function, it will be set once and then not change for the duration of the function.
If the const is declared inside the while loop, for each loop the const will be declared as a new variable, and when it cycles to the next loop it is recreated.
Does this work if you change the const above the while loop to 'let'?
Am I missing something, the console log for n is 7 and it says expected a result of '8' and a log of 13 expects '16'. That is not correct when reading the description. Unless I am missing something fundamental?
Nice Kata - appears simple but the large numbers cause some great alternative thinking on the python solutions. Thank you
Good afternoon,
Im no expert, but const is not changeable once it is declared, so if it is declared in the scope of the whole function, it will be set once and then not change for the duration of the function.
If the const is declared inside the while loop, for each loop the const will be declared as a new variable, and when it cycles to the next loop it is recreated.
Does this work if you change the const above the while loop to 'let'?
What language are you trying to learn?
Am I missing something, the console log for n is 7 and it says expected a result of '8' and a log of 13 expects '16'. That is not correct when reading the description. Unless I am missing something fundamental?
This comment is hidden because it contains spoiler information about the solution