Learn Javascript Fundamentals-Local Scope

Written by sumeyra-davran | Published 2019/08/10
Tech Story Tags: learn-javascript | javascript-fundamentals | latest-tech-stories | software-development | programming | local-scope | function-scope | block-scope

TLDR Global Scope is the first part of understanding scopes in Javascript. Local Scope occurs when you create a variable inside a function, not a global one. Local scope can be divided into two scopes: Function Scope and Block Scope. Until ES6, Javascript only had function scope which is what I have been explaining so far. In Javascript, when you define a variable in global scope and then in local scope, local one takes precedence. Local variables are not accessible and are destroyed as soon as their scope ends.via the TL;DR App

no story

Published by HackerNoon on 2019/08/10