Skip to content

Instantly share code, notes, and snippets.

View AllBitsEqual's full-sized avatar
🦑
coding

Konrad Abe AllBitsEqual

🦑
coding
  • All Bits Equal
  • Berlin, Germany
View GitHub Profile
@AllBitsEqual
AllBitsEqual / JavascriptArraysAndUnicorns.js
Last active September 21, 2021 14:12
A short rundown of JavaScript Array methods, visualised using Emoji because people love emoji... [🦄💩]
/*
* some helpers to keep the examples clean
*/
const makeUnicorn = (animal) => animal === '🐴' ? '🦄' : '💩'
const isUnicorn = (animal) => animal === '🦄'
const isNoUnicorn = (animal) => animal !== '🦄'
const countUnicorns = (count, animal) => count + (animal === '🦄' ? 1 : 0)
const copyAnimals = (animals) => [...animals]