During code optimisation of my project, I was replacing all instances of var
keyword with let
because I think there is no particular use left for var
. I did a 'Find & Replace' in all files to do this.
In some custom modules I had used statements like:
var exports = module.exports = {};
which worked fine.
Now, after replacing it with let
, it became:
let exports = module.exports = {};
It does not work now and gives an error
SyntaxError: Identifier 'exports' has already been declared
Though I can use var
and avoid this problem, I still want to know what is the reason behind this.
via Mohit Bhardwaj
No comments:
Post a Comment