The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Issue with input field Reply To: Issue with input field


What is the actual application? Are you using this as a challenge (e.g., like a captcha)? Or are you just looking for a particular word in a larger string of input?

If it’s a challenge, I would argue that it should fail.

“word” is not the same as ” word”.

If you’re just looking for a particular word, then use a regex. They’re not scary, and your case is very simple:

/\bword\b/.test( ' word' );

it happened