redeclaration of const
If you run a script twice in intelli shell, and you use a cons x = 3, you cannot run the script again.
[js] TypeError: redeclaration of const x :
even if you change it to a var afterwards, it still produces that error.
It seems that the context is kept between running scripts?
3
votes
Gerhard Pretorius
shared this idea
-
Gabriel commented
It's really weird to have the same context the second time you run a script, but you can use an IIFE (Immediately Invoked Function Expression)
(function () {
// your code
})();