Variables + Javascript

Variables + Javascript

Using Variables

Using Variables

Variable are like containers in JavaScript. Using variables to store data is the foundation of the language, and it is done in three distinct parts.

  1. Variable Declaration: Here the variable is registered in its corresponding scope, the scope of a variable is simply “where the variable can be used.” We’ll be talking more about scope in the next lesson.

These are examples of variable declarations:

var x;
var cup;
var car;
  1. Variable Initialization: This usually occurs when a variable is declared. Here the variable is assigned a memory or space by the JavaScript engine. Because of this, once a variable is declared, it takes a value of undefined even before assignment.
  2. Variable Assignment: Variable assignment is usually the most important step when using a variable. Here the variable is assigned data which is a value using the assignment operator “=”. Values in JavaScript take one of the standard JavaScript datatypes which are:
  3. String
  4. Number
  5. Boolean
  6. Null
  7. Undefined
  8. Any of the complex data structures (Array and Objects)
var x         = 5;             // Number
var name      = "Chris";       // String
var developer = true | false;  // Boolean
var location  = null;          // Null
var blue;                      // undefined

The syntax for assigning data types can be seen above with only strings having single or double-quotes. Also, boolean values are either true or false.

javascript programming javascript-tips react

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

How native is React Native? | React Native vs Native App Development

Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.

JavaScript Date: Building a React Hook For Date Selector

This week, I had to construct a date selector form in React that looks like this. As you can see, the user interface includes the surrounding month and date options in addition to the selected date. This means that I need to not only keep track of the current date, but I also need a way to conveniently figure out how many days are in the selected month.

top 30 Python Tips and Tricks for Beginners

In this post, we'll learn top 30 Python Tips and Tricks for Beginners

7 Simple JavaScript Tips for Optimizing Your Code

You may not know about these tips 7 Simple JavaScript Tips for Optimizing Your Code

Create a Tip Calculator with React and JavaScript

In this tutorial, we’ll look at how to create a tip calculator with React and JavaScript. React is an easy to use JavaScript framework that lets us create front end apps.