Skip to content

Instantly share code, notes, and snippets.

View andrekovac's full-sized avatar
🐒

André Kovac andrekovac

🐒
View GitHub Profile
const express = require('express');
const app = express();
// Application
app.get('/', function(req, res) {
if (process.env.NODE_ENV === 'development') {
for (var key in require.cache) {
delete require.cache[key];
}
}
@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]