I am changing my es5 code to es6 in my Angular 1.6 file(s) so started using let
and const
instead of var
but quite confused about named function expression whether it should be const
or let
?
es5
var foo = function () { ... }
es6
let foo = () => { ... }
or
const foo = () => { ... }
does mixing let
and const
within same js file for named function does impact the performance or we should stick with var
?
In my understanding, functions are the things that always unchangeable in one JS file so we can use const
.
Please give some useful explanation.