lundi 2 novembre 2015

If word ends with Javascript

I need some way to check if a word ends with certain letters. Basically, the user enters a string, which is split into words using:

var res = spanish.split(" ");

After this I need a way to check if any words in the string contain the letters 'est'. Right now I'm accomplishing that using

if (spanish.indexOf("est") !=-1) {

            }

After this, I need a way to check if the word containing 'est' ends with 'oy'. Any ideas?

Aucun commentaire:

Enregistrer un commentaire