Message from JavaScript discussions

January 2019

β€” Hmm.. wait, it puts "0" at the end🀀

β€” 

Behold:

THREAD = (chain) -> # {{{
return new Promise (complete) !->
index = 0
step = (i) !->
switch i
# next
| true =>
if not i = chain[++index]
complete!
return
# repeat
| false =>
i = chain[index]
# finish
| -1 =>
complete!
return
# jump
| otherwise =>
index := i
i = chain[i]
# run
new Promise i .then step
###
step false
# }}}

β€” πŸ˜…

β€” 

decrypt = (s) ->
###
words = s.split '32-'
###
for a,i in words
# decrypt word
b = ''
while (j = a.indexOf '0') != -1
# bite chunk
k = parseInt a.substring 0, j
a = a.substring j
# decrypt char
b += letter[k]
# replace
words[i] = b
###
return words.join ' '

Message permanent page

β€” Not tested

β€” Just stop

β€” It can stop if you say resolve(-1);🀀

β€” Encoding flow control as numbers and booleans is insane

β€” Wtf, wouldn't it be resolve(false) ?

β€” False repeats

β€” Like recursion

β€” What does true do then?