Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

reg ex with filter in js

function countSmileys(arr) {
  return arr.filter(x => /^[:;][-~]?[)D]$/.test(x)).length;
}
Source by www.codewars.com #
 
PREVIOUS NEXT
Tagged: #reg #filter #js
ADD COMMENT
Topic
Name
2+9 =