Last active
January 28, 2016 19:02
-
-
Save z4o4z/e814ea2671a278c43765 to your computer and use it in GitHub Desktop.
This file contains 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 doubleNum (number) { | |
var string = number.toString(); | |
var length = string.length; | |
var left = string.substr(0, length / 2); | |
var right = string.substr(length / 2, length); | |
if (left === right) { return number; } | |
return number * 2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment