Illegal Shadowing Javascript

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

	if (true) {
		let a = "Hi"; // Successful shadowing

		// Illegal Shadowing
		var b = "Goodbye"; // SyntaxError: 'b' has already been declared

		console.log(a);
		console.log(b);
	}
}

test();

Variable Shadowing Javascript