Sitemap
selvanivas

selvanivas

I am a third-year Computer Science student passionate about learning and sharing knowledge in software development and technology.

The Basics of JavaScript

3 min readAug 21, 2026

What is javascript?

When we open a website we can see lots of text images and buttons,etc . basically javascript is used to make the website more interactive and update the changes based on the actions by the user.

we all know the html is used to provide the structure and css is used to provide the styles .

the javascript enables the user can make the changes and update the changes when the action is triggered.

the javascript can be added in two ways

1.It can be directly add on the html body.

Press enter or click to view image in full size

2.add the external js file into script in the body.

Press enter or click to view image in full size

Var Let Const :

These are all the javascript keywords used to declare the variables and initialize the values to the variables.

Each of the keyword have separate scope , hoisting , reassignment.

basic terms:

Declaration: create a variable with the value .

Initialization: assign the value for the declared variable.

Reassignment: changing the value for already assigned value.

Redeclaration: declare the same variable again with new value.

first we discuss about the scope of these :

three scope types are there : 1.global 2.funtional 3. block

Global Scope: the declared variable can be accessed throughout the program .

Funtional scope: the declared variable can be accessed within the function.

Block Scope: the variable can be accessible within the block.

Get selvanivas’s stories in your inbox

Join Medium for free to get updates from this writer.

Hoisting: basically javascript process the declarations on the top of the code before execution .

we can see the comparision of these keywords based on these terms:

Press enter or click to view image in full size

DataTypes in Javascript:

In javascript two types of datatypes are there:

  1. primitive datatype: it can store only one value for the one variable
  2. non-primitive or reference datatype: it can store the address of the many values in a container.

Primitive datatypes:

String → it is used to write text content .

Number → it is used to write a numbers digits (+ ,-)

Bigint →it is also used for number but it is larger in size.

Boolean →it is either to be true or flase (logical operation).

Null →it is a empty value but it is value and store in a container.

Undefined →it is basically a variable without value not consider as empty value or anything .

Press enter or click to view image in full size

Non — primitive datatypes:

  1. Object : it is basically used to store related data into a single variable and the data can be accessed through the address basically the variable know the address/reference of the values.

It is stored in the form of key-value pairs

key- is the property to access the value.

2. Arrays : it is used to store the multiple values and store the data in a ordered list

the value can be accessed through the indexes.

--

--

selvanivas
selvanivas

Written by selvanivas

I am a third-year Computer Science student passionate about learning and sharing knowledge in software development and technology.