Skip to content

Sunar3/JavaScript-Variables-and-Data-Types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

JavaScript Variables and Data Types

What is JavaScript?

JavaScript is a widely used scripting language that adds functionality and interactivity to a webpage. Building on a static HTML framework and CSS styling, with JavaScript you can store information in variables, manipulate your HTML, respond to an event, play audio and video, add decision-making statements to your code, and do much more.

As the only programming language native to web browsers, JavaScript is used all over the web making it a crucial skill in your toolbox. But Javascript development skills are also versatile. Once you have mastered JavaScript, it is much easier to pick up the fundamentals of other programming languages.

What is Variables?

In JavaScript, variables are just like a bucket where you can store anything you want and use it when needed. Variables are bucket for storing values and use them when needed.

For example:


const firstName = 'Archie';

In the above example "firstName" is a variable name or a bucket for storing value. In this case our value is "Archie".

Ways to declare or creating a variable?

In JavaScript there are four ways to declare a variable.

  1. Automatically
  2. var
  3. let
  4. const

If the condition meet we should always use const to declare a variable. If not we can use let. We should only use var if the programme has to support older verson of JavaScript code.

What is Data Types?

The data or values stored in the variables are data and the types of data stored in them are determined the types of data. Take a look the code below:

const name = 'Aarav';

"Aarav" is a value of name variable. 'Aarav' is a string, we know that because it is in the quotation ''. Thus, this tells us that it is a string data type. Look at another example below:

const X = 123;

In this example, X is a variable name and has a 123 values. The value in the X variable is number. Hence, its data type is number.

Data types in JavaScript?

Data types in JavaScript are:

  • Undefined
  • String
  • Number
  • Boolean
  • Symbol
  • Object
  • Null
  • BigInt

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages