Variable Shadowing Javascript

function test() {
	let a = "Hello";

	if (true) {
		let a = "Hi";
		console.log(a); // Hi
		// variable a is shodowed in this block
	}

	console.log(a); // Hello
}

test();

Illegal Shadowing Javascript