Skip to content

Instantly share code, notes, and snippets.

@jamesmcallister
Last active June 5, 2020 12:26
Show Gist options
  • Save jamesmcallister/9fa2513a5ea446712e43550f79fe9d89 to your computer and use it in GitHub Desktop.
Save jamesmcallister/9fa2513a5ea446712e43550f79fe9d89 to your computer and use it in GitHub Desktop.
whiskybase random tipple
function whichWeDram() {
const openBottles = [...document.getElementsByClassName("shelft-bottle-open")].map(
({ firstElementChild }) => firstElementChild.dataset.title,
);
const closedBottles = [...document.getElementsByClassName("shelft-bottle-closed")].map(
({ firstElementChild }) => firstElementChild.dataset.title,
);
const openBottle = openBottles[Math.floor(Math.random() * openBottles.length)];
const closedBottle = closedBottles[Math.floor(Math.random() * closedBottles.length)];
return {
"feeling brave": closedBottle,
"how about this one" :openBottle
}
};
whichWeDram()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment