Skip to content

Instantly share code, notes, and snippets.

@ghalimi
Created January 13, 2013 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ghalimi/4524732 to your computer and use it in GitHub Desktop.
Save ghalimi/4524732 to your computer and use it in GitHub Desktop.
DELTA Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
function DELTA(number1, number2) {
// Set number2 to zero if undefined
number2 = (typeof number2 === 'undefined') ? 0 : number2;
// Return error if either number is not a number
if (isNaN(number1) || isNaN(number2)) return '#VALUE!';
// Return delta
return (number1 === number2) ? 1 : 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment