Home › Forums › JavaScript › Issue with input field › Reply To: Issue with input field
September 27, 2013 at 10:33 am
#151496
__
Participant
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' );