-
-
Save camerond/2502862 to your computer and use it in GitHub Desktop.
WTF CoffeeScript (refactor)
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
# Refactor of shane_riley's issue | |
$("dl.card :text").change -> | |
$e = $(@) | |
val = $e.val() | |
odd = [] | |
even = [] | |
for v, i in val.split("") | |
if !(i % 2) then odd.push(v) | |
else | |
e = ("" + (v * 2)).split("") | |
even.push(+e[0] + +e[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment