Created
February 18, 2019 19:10
-
-
Save richardtaylordawson/03617e9dc13acfb26cb63f27443381e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function narcissistic(n) { | |
var t = 0; | |
var i = 0; | |
var v = value.toString(); | |
var l = v.length; | |
for(; i < s; i++) { | |
t += Math.pow(v[i], s); | |
} | |
return t == n; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We found out var was faster that’s why haha