Message from JavaScript discussions

July 2017

— And just + 1 everytime you get a hit?

— 

const findNames = (text, name, start = 0, hits = []) =>
(hit => hit === -1
? hits
: (end =>
(hits.push(text.substring(hit, end)),
findNames(text, name, end, hits))
)(hit + name.length)
)(text.indexOf(name, start));

— Floofies What do you think about the readability of this?

— Exact same algorithm

— What does === mean ?

— Strict equal to

— Ok

— I do like the way lisp does local variables

— :( the second approach is slower

— Functions aren't THAT cheap in JS apparently

— I personally only use lambdas for one liners, but aside from that why not just use one of the string search builtins?

Message permanent page

— Yup they are slow to start