Just playing with the repl I tried to set a variable but glitched it, and found the variable became permanently inaccessible if not initialized when declared properly.
So first we have a variable with a text string in it not really important.
Next I mistakenly noobed as I hoped to call TextEncoder without 'new', being in the REPL and all.
the target variable name becomes inaccessible and undeleteable at that point.
> let txt = "File Contents here!"
undefined
**> let dta = TextEncoder().encode(txt)**
Uncaught TypeError: Class constructor TextEncoder cannot be invoked without 'new'
at <unknown>:3:11
at evaluate ($deno$/repl.ts:54:34)
at Object.replLoop ($deno$/repl.ts:156:13)
**> let dta**
Uncaught SyntaxError: Invalid or unexpected token
at evaluate ($deno$/repl.ts:54:34)
at Object.replLoop ($deno$/repl.ts:156:13)
**> let dta = "data"**
Uncaught SyntaxError: Identifier 'dta' has already been declared
at evaluate ($deno$/repl.ts:54:34)
at Object.replLoop ($deno$/repl.ts:156:13)
**> dta = "data"**
Uncaught ReferenceError: Cannot access 'dta' before initialization
at <unknown>:3:5
at evaluate ($deno$/repl.ts:54:34)
at Object.replLoop ($deno$/repl.ts:156:13)
> delete dta
Uncaught SyntaxError: Delete of an unqualified identifier in strict mode.
at evaluate ($deno$/repl.ts:54:34)
at Object.replLoop ($deno$/repl.ts:156:13)
> dta = undefined
Uncaught ReferenceError: Cannot access 'dta' before initialization
at <unknown>:3:5
at evaluate ($deno$/repl.ts:54:34)
at Object.replLoop ($deno$/repl.ts:156:13)
**> dta = null**
Uncaught ReferenceError: Cannot access 'dta' before initialization
at <unknown>:3:5
at evaluate ($deno$/repl.ts:54:34)
at Object.replLoop ($deno$/repl.ts:156:13)
Minimal repro:
> let a = (() => { throw new Error(); })(); // The initializer throws.
Uncaught Error:
...
> a = "abc";
Uncaught ReferenceError: Cannot access 'a' before initialization
...
> let a;
Uncaught SyntaxError: Identifier 'a' has already been declared
...
Node shares this bug. In the Chrome and Firefox consoles, the second command succeeds. (Note that Chrome devtools allows redeclaration of let variables so the third command will also succeed. For us it should just fail like it does.)
After https://github.com/denoland/deno/pull/7784, we can now get around this with let a = ..., but a = ... still fails, in line with what @nayeemrmn said:
> let a = (() => { throw new Error(); })(); // The initializer throws.
Uncaught Error:
at <anonymous>:2:24
at <anonymous>:2:39
> a = "abc";
Uncaught ReferenceError: Cannot access 'a' before initialization
at <anonymous>:2:3
> let a = "abc"
undefined
> a
"abc"
CC @caspervonb
So with the let-redeclarations introduced in #7784 I think we can close this.
Our current behavior matches Chrome's inspector and you can fix an uninitialised variable by redeclaring it.
Yeah, looks like we should close. I can also reproduce in the Chrome inspector:

The earlier repro doesn't work now that let redeclarations are allowed, but see this:
> let a = (() => { throw new Error(); })(); // The initializer throws.
Uncaught Error:
...
> a = "abc";
Uncaught ReferenceError: Cannot access 'a' before initialization
...
> const a = 1;
Uncaught SyntaxError: Identifier 'a' has already been declared
...
But yeah, we match Chrome so this is upstream.
I think we can close this issue as resolved.