Skip to content

Instantly share code, notes, and snippets.

@alexpilugin
Created July 9, 2017 10:03
Show Gist options
  • Save alexpilugin/1c859d8bc4d2dd25b4789f10755ab99b to your computer and use it in GitHub Desktop.
Save alexpilugin/1c859d8bc4d2dd25b4789f10755ab99b to your computer and use it in GitHub Desktop.
function isEven(a) {
if (a < 0) a = -a;
if (a == 0) return true;
if (a == 1) return false;
return isEven(a - 2)
}
@alexpilugin
Copy link
Author

alexpilugin commented Jul 7, 2021

// No recursion:

function isEven(value) {
    if (value % 2 == 0)
        return true;
    else
        return false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment