Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2021
    Location
    Bangalore
    Posts
    127

    Local and Global Scope Variables in JavaScript

    Global Variables − A global variable has a global scope which means it can be defined anywhere in your JavaScript code.
    Local Variables − A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.

  2. #2
    Senior Member
    Join Date
    Nov 2018
    Posts
    1,855
    JavaScript has global scope and local scope. Variables declared and initialized outside any function become global variables. Variables declared and initialized inside function becomes local variables to that function. Variables declared without var keyword inside any function becomes global variables automatically.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.