oczor icon indicating copy to clipboard operation
oczor copied to clipboard

const

Open ghost opened this issue 6 years ago • 0 comments

some of the JavaScript examples look like this:

var func = function(x, y) {
   return x + y + 1;
};

however var is rarely what will be wanted with a function. better would be this:

const func = function(x, y) {
   return x + y + 1;
};

or it can be wrapped in a block if needed for the console or a bookmarklet:

{
   const func = function(x, y) {
      return x + y + 1;
   };
}

ghost avatar Jun 06 '19 14:06 ghost