Last active
August 29, 2015 14:00
-
-
Save bsa7/d15fff7d5d42baa50875 to your computer and use it in GitHub Desktop.
coffeescript for
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
# iterate 0 to n | |
for e in [0..n] | |
console.log e | |
# iterate in array with element (itm) and index (i) | |
sort_weigth = (arr) -> | |
w = 0 | |
for itm, i in arr | |
w += (itm == 0 ? 0 : 1) * Math.pow(10, arr.length - i) | |
w | |
# iterate in array with element (itm) | |
res = "" | |
for e in arr | |
res += e.toString() | |
#iterate each jQuery object | |
$("li").each (index) -> | |
console.log index + ": " + $(this).text() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment