Back to course home
0% completed
Vote For New Content
why doesn't for in loop
axle982
Dec 26, 2024
why doesn't a for in loop work instead of using a while loop
0
0
Comments
Comments
J
johannes.welsch 10 months ago
of course it would also work
reverseString(s) { const stack = Array.from(s) let reversedString = "" for (let i = 0; i < s.length; i++) { let currentLetter = stack.pop() reversedString = reversedString +...
T
traviswlilleberg 5 days ago
If you're talking about line 10 ...
while (stack.length > 0) {
... a for in loop would iterate over the string starting with the first character in the string and move towards the last character in the string. This would not reverse the string. You need to star...
On this page