SyntaxFix
Write A Post
Hire A Developer
Questions
Instead of calling the substring function you could use .slice()
substring
.slice()
imageIndex = parseInt(id.slice(-1)) - 1;
Here, -1 in slice indicates that to start slice from the last index.
Thanks.