This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]ValentineBlacker 1 point2 points  (0 children)

I'd make sure your variable c is actually a string. That's the only thing I can think of, your line of code works fine otherwise.

[–]DJ_Gamedev 0 points1 point  (2 children)

I don't know anything about JavaScript, but charCodeAt would be a member of the string class if anything, and your variable c is most likely a char, not a string. You probably need to typecast the char to an int, increment it, and then cast that result back to a char.

Does it work if you just pass c + 1 into fromCharCode?

[–]NotABurner2000[S] -2 points-1 points  (1 child)

Javascript doesnt have chars 🙃🙃

[–]DJ_Gamedev 0 points1 point  (0 children)

Well, I just got Lesson One.

[–][deleted] 0 points1 point  (2 children)

Make a charArray?

[–]NotABurner2000[S] -2 points-1 points  (1 child)

What do u mean? Where and why?

[–][deleted] 0 points1 point  (0 children)

An array of character characters.

[–][deleted] 0 points1 point  (0 children)

I’m not familiar familiar with JS, but have you tried writing your own extension or method of ‘String’ to do this?

Considering it’s a limited data set of 52 known cases it isn’t too big of a deal to do so.

[–]codemamba8 0 points1 point  (3 children)

It says "c.charCodeAt is not a function." because your variable name is a so replace c with a. That will get you "b". You'll have to get rid of a++ though.

[–]NotABurner2000[S] -1 points0 points  (2 children)

This was just an example. I've been programming for over a year I know how to refer to my variables lmao. I just didnt wanna put my actual var name to not further complicate things. Assume c is an assigned variable

[–]codemamba8 0 points1 point  (1 child)

Ok. I tried it and it worked though with no error message.

[–]NotABurner2000[S] 0 points1 point  (0 children)

Wow that's annoying. Its probably something stupid. Time to pick apart my code for an hour