dimanche 23 octobre 2016

What operator to use in JavaScript for determining if part of a value is equal?

I want to create an if statement that will run if the text the program scans contains a certain word. The problem is, it only runs if that text is only the stand-alone word itself.

What i mean by this is if I have:

if (text == 'car')

Then it will not execute if the text says, for example, 'Red car'. Is there anyway to make this work?

Aucun commentaire:

Enregistrer un commentaire