I do my first internship, and it is going well, and I try to keep up with everything that other programmers are talking about. A senior programmer told me the other day that the ability of Rubys to pass blocks of code directly to functions was much more preferable than using anonymous functions in JavaScript. His understanding that anonymous JS functions are exactly the same thing is to simply pass a block of code through a variable as a parameter. Are there real examples of code block parameters that are superior to anonymous functions? Or is it just a matter of preference in one language over another, the problem of readability / reuse of code, or am I just misunderstanding some other fundamental concept? It was a conversation about the relative merits of which language to use for some task, and not about the specific problem of work, which, for some reason, might be confused. I was looking for a couple of naive examples of code blocks and had no problems with their implementation in JS. We look forward to any information on this subject (anonymously or otherwise).
source share