Nick Huemmer

13 April 2022

Filter the Smileys 😀

This is my first post, testing out this Astro platform to use as a blog template.

// Here's a fun Regex example that finds smileys in an array.

const faceArray = [";D", ":-(", ":-)", ";~)"]

const countSmileys = (arr) => 
	    arr
      .map(x=> /[;|:][-|~]?[\)|D]/gm.test(x))
      .filter(x=> x === true).length


countSmileys(faceArray) //3