Posts

Showing posts with the label variables in computer programming

Learn JavaScript : Global and Local Scope (Part 3)

Image
Introduction The concept of "Scope" in computer programming, can be understood in terms of the accessibility of data. In simple terms let's consider this scenario; As a Coder, consider that you code in blocks of code and that anytime you create a function or a variable outside a block of code like a function or class, it is called a global scope and when you define and declare variables and functions within a function or a class or any block of code it is called a local scope .  Kindly study the following Parts in case you had skipped them. JavaScript Introduction JavaScript Variables Now, consider the global scope and local scope as contextual. Meaning data created in a global scope is different from data created in a local scope. But in a programming setting, data created in a global scope is mostly accessible in a local scope context or block. How scopes behave may be different in other programming languages. Especially with the process of how data in a loc...

Learn javaScript : Variables (Part 2)

Image
Today's article will focus on variables in JavaScript, where we would look at the various ways or options available in creating a variable with this amazing programming language. Variable in computer programming is a container that holds data, this data can mostly be of any type which helps in developing the logic for a particular function. Variables in JavaScript can hold integers, strings, functions, classes, and boolean values. Do not worry if you do not understand these things, we will focus on them later on in this series. Kindly study the following Part in case you had skipped it. JavaScript Introduction Ways of declaring a variable in JavaScript     There are four (4) ways of declaring a variable; 1. Using the var keyword to declare a variable.     sample code     var x = 2; // output 2 2. Using the let keyword to declare a variable.        sample code      let y = 3; // output 3 3. Using the const keywo...

followers