Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of scoping rules in JavaScript
/* Scoping Rules - let, const, var */
function test() {
//Block Scope
var b = 7;
const a = 3;
let c = 22;
console.log(a, b, c);
//b is still defined.
//a, and c are not defined
console.log(a, c);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment