10 JavaScript Fundamental You Should Know

Md. Abid Nuri
4 min readMay 5, 2021

--

First of all, We all are afraid about to learn JavaScript. JavaScript is not a very complicated language at its core. It can seem difficult to learn because of all of the noise around it. Be patient and read the article from top to bottom.

JavaScript Fundamental

What is JavaScript?

Basically, JavaScript is one of the popular and widely used languages and for web and applications. JavaScript is very easy to implement because it is integrated with HTML. It’s very lightweight, scripting and interpreted programming language used to create and control dynamic website content.

1. Variable s—

There are 3 variable keyword in JavaScript

a. var
b. let
c. const

2. var —

var is global variable. Before 2015 it’s the only way to declare a variable. When A variable declared with the var keyword is available from the function it is declared in. When we declare this variable keyword it will can access everywhere.

var variable

Here is an example of scope with a variable declared with var:

It’s type is undefined when you declare a variable without assigning any value to it.

3. let —

This variable usually uses inside of the function. It’s not a global variable.

4. const —

const variable is allows to declare fixed thing, whose values is never changed.

5. Numbers —

Only one type of number in JavaScript. Numbers can be written with or without decimals:

Number with and without decimal

6. String —

JavaScript strings are used for storing and manipulating text. Strings are written in three way.

a. Single quotes
b. Double quotes
c. Template strings

String in JavaScript

7. Booleans —

JavaScript booleans can have only two values either true or false. We can use Boolean() function to find out if an expression is true.

Boolean in JavaScript

8. slice ()—

The slice() method extracts parts of a string and returns the extracted parts in a new string without modifying the original string. This method uses two parameters from which index to start, before which index to end. If starting index is given but the ending index is not given, it takes to the length of the string. Example:

slice()

9. Delete Operators —

It deletes a property from an object.

Delete Operator

10. Ternary Operator —

Ternary operator looks like If else condition system. This assigns a value to a variable based on a condition.

Ternary Operator

11. Array Methods: pop() —

This method changes the original array length. The pop method deletes the last element of an array and returns the value of the element deleted.

Example:

pop()

12. Array Methods: push() —

This is the opposite method of the pop() method. The push() method inserts an element as the last element of an array and returns the value of the element inserted. It changes the original array length.

push() method

13. Array Methods: shift() —

The shift() method is slightly similar to the pop() method, but the difference is shift() method deletes the first element, and the pop() method deletes the last element. The shift() method removes the first element of an array and returns the value of the element removed. This method changes the original array length.

Example:

Shift Method

Thanks For Read This

--

--

Md. Abid Nuri
Md. Abid Nuri

Written by Md. Abid Nuri

A MERN Stack Developer. Want to explore new technologies and learn.

No responses yet