Sign in

JAVASCRIPT BASICS
JAVASCRIPT BASICS

Today JavaScript is one of the most popular programming languages. Now there will be a brief discussion about JavaScript.

1. Data Types:

Data is the smallest part of any information. DataType means what kind of data.

There are two types of data types in JavaScript.

1. Primitive data type (Number, String, Boolean, Undefined, Null)

2. Non-primitive / reference data type (Object = (Function,

Array, Date, RegExp)).

2. Conditional Statements:

The conditional statement is that the execution of the program depends on one or more conditions.

There are three types of conditional statements in JavaScript.

1. if Statement

2. if ……


JavaScript Truthy Values:

In JavaScript, a truthy value is considered true when encountered in boolean.

Truthy Values:

  1. Without zero (0) any number is truthy value.
  2. Without Empty String (“”) any string value is truthy value.
  3. Any Empty Array [ ] is truthy value.
  4. Any Empty Object { } is truthy value.

JavaScript Falsy Values:

In JavaScript, a falsy value is considered false when encountered in boolean.

Falsy Values:

  1. If any value is Undefined, the value is Falsy.
  2. If any value is Null, the value is Falsy.
  3. If any value is NaN, the value is Falsy.
  4. If any value is false (using this keyword), the value is…

What is React?

React is the most famous library of JavaScript. It is used for making user interfaces & Single Page Application.

How does React Work?

In-depth, React maintains a tree. This tree can do different computations on the nodes efficiently. Think about your HTML code as a tree. How the browser treats your DOM (your rendered HTML on the browser). React allows you to effectively reconstruct your DOM in JavaScript and push only those changes to the DOM which have occurred. React creates a virtual DOM in memory. Instead of manipulating the browser’s DOM directly, React creates a virtual DOM in memory, where it does…


Var Declarations:

The var keyword declares a function or globally-scoped variable.

Example:

var a = 10;

if (a === 10) {

var a = 20;

console.log(a);

// expected output: 20

}

console.log(a);

// expected output: 20

Let Declarations:

The let keyword declares a block-scoped local variable. The variable type let shares a lot of similarities with var but, unlike var, has scope constraints. Its declaration and assignment are similar to var. When a programmer needs to variable scope, let keyword helps them.

Example:

let b = 10;

if (b === 10) {

let b = 20;

console.log(b);

// expected output: 20

}

console.log(b);

//…

Khushbu Islam Misbah

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store