Skip to content

Instantly share code, notes, and snippets.

@kepta
Last active November 19, 2017 09:01
Show Gist options
  • Save kepta/722fa4ffa9866e4f4412613fc4006728 to your computer and use it in GitHub Desktop.
Save kepta/722fa4ffa9866e4f4412613fc4006728 to your computer and use it in GitHub Desktop.
function findEvil(array, evil = 'darth vader', respect = 'Bad ' + evil) {
if (array.find(item => item === evil)) {
return respect;
}
}
findEvil(list); // Bad darth vader;
findEvil(list, 'luke'); // Bad luke;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment