Re:Show HN: Visualizing 'Silhouettes' of Programming Languages
by z3t4 on Friday June 30, 2017 @05:24PM
(#14673684)
always name your anonymous functions. that way it will be easier to break them out of the pyramid, make them testable, and easier to debug.
[ Parent
| on HN ]
Re:Show HN: Visualizing 'Silhouettes' of Programming Languages
by OJFord on Saturday July 01, 2017 @05:13PM
(#14679066)
... and it will also make them not anonymous functions :)
Re:Show HN: Visualizing 'Silhouettes' of Programming Languages
by z3t4 on Monday July 03, 2017 @05:18AM
(#14686949)
A named "anonymous" function (lets call it lamda function to make it less confusing) is still a lamda function, but with a name ... It can not be called from elsewhere. So you get all the benefits from lamda functions! There's no advantage to not naming variables.
var fs = require("fs");
fs.readFile("somefile.txt", function readSomeFile(err, text) {
if(err) throw err;
else console.log(data);
}