Skip to content

Instantly share code, notes, and snippets.

💭
Squashing bugs 👾

Michael Englo michaelenglo

💭
Squashing bugs 👾
View GitHub Profile
@michaelenglo
michaelenglo / riddle.js
Last active Jun 13, 2020
What does this JS code evaluate to?
View riddle.js
const noOfShownComments = 5;
const commentsIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
console.log(!!(noOfShownComments => commentsIds.length
? true
: false}));
@michaelenglo
michaelenglo / gist:74577990a139ca3c7ff5c2d501df43d4
Last active May 18, 2020
The world's cleanest switch statement.
View gist:74577990a139ca3c7ff5c2d501df43d4
This is how regular switches are typically made:
function regularSwitch(case) {
switch(case) {
case "default":
return "green";
case "ignored":
return "red";
case "selected";
return "grey";
You can’t perform that action at this time.