Im really bad at this, just trying to learn. Im going to re-evaluate the indexOf methods as i know understand why that isnt the right one to use and change the variable names.
Im outside Philly so i have a bunch of snow coming tonight and tomorow so i will dive into this again on Sunday.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
Ahh, that makes sense, you aren’t playing in the snow, you’re working in the snow.
As for your code, you’ve got a lot going on here. I think you should work on simplifying a bit. Let’s work on the first requirement: You’ll need to remove all non-alphanumeric characters.
You started out on the right track, you’ll definitely want to use a regex to do this. You can think of a string as a series of characters. What you want to do is go through the string character by character and remove any non-alphanumeric ones. Looping through the string is one way to go, but wouldn’t it be cool if there was a JS string method that made this much easier? A method that sort of allowed you to replace all of these characters with another character (such as an empty string character). If you replaced all of the non-alphanumeric characters with an empty string wouldn’t that be the same as removing them from the string?
jeremy,
thank you for the help. will make sure i follow correct format.
bbsmooth
thanks for your time and all the help and advice. Ive been having such a hard time with javascriopt. I still have that feeling like i dont have a handle on it yet. LIke im never sure what the next step should be.
I think i have what was mentioned about using replace to reduce the string to only the alphanumeric characters but i still can only get a ‘false’ when the function runs. I know my for loops must be real sloppy but i cant tell what to change or where to go next