Created
September 23, 2014 19:59
-
-
Save cristianobecker/241ec015ff197fb56641 to your computer and use it in GitHub Desktop.
Obter somente vogais
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var utils = {}; | |
utils.vogal = function (str) { | |
var h = Object.prototype.hasOwnProperty, | |
v = (str + '').replace(/[^aeiou]/g, ''), | |
d = {}, | |
n; | |
for (var i in v) { | |
n = v[i]; | |
if (h.call(d, n)) { | |
d[n]++; | |
} else { | |
d[n] = 1; | |
} | |
} | |
return d; | |
}; |
Author
cristianobecker
commented
Sep 23, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment