0

I write a simple "if" statement in a ".ts" file of React app, but the "if" doesn't work, the code is as follow:

const a = `555`;

if (0<1) 
{
    const a = `333`;
}

In the end, however, the value of "a" is 555 !!! Would you please guide me?

amin
  • 93
  • 8
  • Why decrease "2" in my reputation?? I check the similarity of my question and no one asked this question! I cannot accept this behaviour that people are criticized for asking questions! – amin Aug 05 '22 at 23:15
  • 1
    `const` creates a _new_ variable that only exists inside `{` and `}` – Evert Aug 05 '22 at 23:35

0 Answers0