This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function partition(inputArray, callback) { | |
const result = {}; | |
for (const [indexOfValue, value] of inputArray.entries()) { | |
const propertyKey = callback(value, indexOfValue); | |
if (propertyKey === null || propertyKey === '') { | |
continue; | |
} | |
if (!{}.hasOwnProperty.call(result, propertyKey)) { | |
result[propertyKey] = []; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copy this into the console of any web page that is interactive and doesn't | |
do hard reloads. You will hear your DOM changes as different pitches of | |
audio. | |
I have found this interesting for debugging, but also fun to hear web pages | |
render like UIs do in movies. | |
*/ | |
const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |