I wanna make a code which reverses the text
So you want your for loop to start at the last letter of
'hello', and loop until it reaches the first letter.
i is set to
string.length, which is
6. Remember that indexing starts at
0, so the index of the
let i = string.length to
let i = string.length - 1
Also remember that the 2nd part of the classic for loop tells the loop to run as long as a certain condition is true. As soon as it becomes false, the for loop stops.
Right now you have
i === 0. This means that the loop is stopping as soon as you start it, because you’ve set
i to a number greater than
i === 0 to
i >= 0.
Hope this helps!