Skip to content

Instantly share code, notes, and snippets.

@Underdoge
Created February 26, 2017 07:43
Show Gist options
  • Save Underdoge/bd250af577627382f3ca95983da91a93 to your computer and use it in GitHub Desktop.
Save Underdoge/bd250af577627382f3ca95983da91a93 to your computer and use it in GitHub Desktop.
isLucky
function isLucky(n) {
var numbers=n.toString().split("");
var a=0,b=0;
for(i=0;i<numbers.length/2;i++){
a+=parseInt(numbers[i],10);
b+=parseInt(numbers[numbers.length/2+i],10);
}
return a===b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment