-
Notifications
You must be signed in to change notification settings - Fork 309
Open
Description
The function you've written is almost correct, but there's a small mistake in the loop condition. The loop should iterate until str.length, not str.length-1. This is because array indices in JavaScript (and most programming languages) are 0-based, meaning the last index is length-1. By using str.length-1, you're missing the last character in the string.
(var i=0; i<str.length; i++)
Metadata
Metadata
Assignees
Labels
No labels