Skip to content

Instantly share code, notes, and snippets.

@pbroschwitz
Created July 23, 2013 12:33
Show Gist options
  • Save pbroschwitz/6062028 to your computer and use it in GitHub Desktop.
Save pbroschwitz/6062028 to your computer and use it in GitHub Desktop.
function aContainsB (a, b) {
return a.indexOf(b) >= 0;
}
var philosophers = "Aquinas, Maimonedes, and Avicenna";
var me = "Joshua";
function printPhilosopherStatus (person) {
if (aContainsB(philosophers, person)) {
console.log(person + " is a philosopher.");
} else {
console.log(person + " is NOT a philosopher.");
}
}
// Outputs: "Joshua is NOT a philosopher."
printPhilosopherStatus(me);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment