While looking through the node.js source code, I have found quite a few var declarations. In the same files I have also found let declarations. let declarations are almost always considered better, and can always be used in place of var declarations. I was thinking about fixing this and creating a PR but wanted to know if there was a specific reason for using var sometimes and let other times. Scope could be a reason, but could be transformed like this:
if(/*...*/) {
var foo = 'bar';
}
//is the same as
let foo;
if(/*...*/) {
foo = 'bar';
}