Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getSum(s) {
- return s.match(new RegExp(/\d+/, 'g'))
- .map(function (t) { return t & 1 ? Math.pow(t, 2) : 0 })
- .reduce(function (total, n) {
- return total + n;
- })
- }
- console.log(getSum("ab2v9bc13j5jf4jv21"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement