Find the Bugš
I'm trying to code a method that takes a single character as an argument and returns the increment of that character. e.g incrementChar('a') outputs 'b' and so on. The code below works fine without the first if statement which is if the input character is a symbol which is not included in the string then it should return the character. But when I add the first if statement as it is below, it does returns the character if it is a symbol but it no longer increments if it is an alphabetic character. I have tried all I could but it doesn't seem to work. What's the problem? function incrementChar(char) { var alphabets = 'abcdefghijklmnopqrstuvwxyz', next = ''; for(let i = 0; i < alphanumeric.length; i++) { if(char != alphanumeric[i]) { next = char; break; } if(char == alphanumeric[i]) { next = alphanumeric[i + 1]; break; } return next; } }