5

I need to redefine a const in the Node REPL because I want to re-run some functions on my history. I am getting this error:

Uncaught SyntaxError: Identifier '_tareas' has already been declared

Is there a way to redefine this constant without having to close the REPL and open it again?

5
  • 3
    Put it in a { ... } block scope. As the name suggests, you can't reassign a constant in a particular scope. Sep 6, 2020 at 16:07
  • If I put things in {} then it does not evaluate line by line showing me the result of each line. But I infer from your answer than there is no way to "un-define" consts. Thank you any ways
    – Alejo Dev
    Sep 6, 2020 at 16:12
  • If you want to reassign it then use let instead of const to begin with... Sep 6, 2020 at 16:14
  • 4
    I know that... I was testing a code copying and pasting in the REPL console
    – Alejo Dev
    Sep 6, 2020 at 16:21
  • github.com/nodejs/node/issues/8309
    – Bergi
    Oct 22, 2022 at 15:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy