Local Scope Variable

Variables declared inside a function are local to that function.

Preview

Code

<script>
function greet(){
  let name = "Alice";
  console.log(name);
}

greet();
</script>

More JS Scope Examples (7)