-
New to Javascript, question about arrays
Hi, thanks in advance for the help. i was wondering how I would find specific words in an array that end in a vowel (aeiou)?
-
when exactly is your homework due?
-
Given an array named myArray with your words you can use
var results=myArray.filter(function(x) { return x.match(/[aeiou]$/i); });
The "results" is an array of all words from myArray the end with a vowel.
Don't forget "y" is a vowel too.
-
Of course you can omit the /i in the regular expression since there is not reason for the last character of a word to be in uppercase.
-
Thanks holyhttp. I was putting the $ on the outside of the []. Thanks also for the y reminder.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks