Skip to content

Instantly share code, notes, and snippets.

@DavidMellul
Created March 13, 2018 21:13
Show Gist options
  • Save DavidMellul/3b3fbdd5af704b223208719fc387e442 to your computer and use it in GitHub Desktop.
Save DavidMellul/3b3fbdd5af704b223208719fc387e442 to your computer and use it in GitHub Desktop.
// Hypothetical NLP function - ES6 includes used
function isTextFunEnough(text) {
if(text.length == 0) {
return false;
}
else if(text.includes('lol')) {
if(text.includes('angry'))
return false;
else
return true;
}
}
console.log(isTextFunEnough('This article is so epic lol') ? 'Definitely fun, LMAO':'Not very funny...');
// => Definitely fun, LMAO
console.log(isTextFunEnough('Lol, how angry do you think I am') ? 'Definitely fun, LMAO':'Not very funny...');
// => Not very funny...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment