Global scope allows a variable to be accessed anywhere in the code, while local (block or function) scope restricts access to the block or function where it’s declared.
let globalVar = "I am global";
function testScope() {
let localVar = "I am local";
}