Skip to content

Instantly share code, notes, and snippets.

@stevencombs
Created September 1, 2013 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencombs/6404969 to your computer and use it in GitHub Desktop.
Save stevencombs/6404969 to your computer and use it in GitHub Desktop.
// Divisible by Two, or any other value, Javascript function code
// Dr. Steven B. Combs, coding novice
var isDivisible = function(number) {
if (number % 2 === 0) { // Number 2 could be any value
return true; // Return true if value is divisible by 2
} else {
return false; // Return false if value is not divisible by 2
}
};
isDivisible (4); // Replace value between parenthesis to evaluate
// Modification: Request user input for both values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment