Sign in

Null Vs Undefined

In javascript Null and Undefined little bit confusing. So, today I will clear the thing. In javascript null means the variable value has empty or you set the value null. When you declare a variable, if the variable value is empty It will show null. In javascript undefined means, you declare a variable but you do not the set value or pass the value, It will show undefined.

const checkValue;
console.log(checkValue)// undefiend
const fun = (num1, num2) => {
const result = fun(25)
console.log(result)// undefined
const text = undefiend;
console.log(text)// undefined
const isNull = null
console.log(isNull) // null


react mechanism

Virtual DOM

As a beginner react developer you might hear the word Virtual DOM. The virtual DOM (VDOM) is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library such as ReactDOM. This process is called reconciliation.

When we render an HTML file in the browser, the browser creates a DOM (Document Object Model) of the page. It looks like a dom tree.

Primitive vs Reference:

In javascript, there are two types of data 1. Value types (primitive) 2. Reference types.

Value types: number, string, boolean, symbol, undefined and null are value types. Let's have an example:

let a = 5;
let b = a;
a = 15;
console.log(b)// 5
console.log(a) // 15

In this example, variable (a) have value 5, when we set value (b = a) it only copies the value of the variable (a). They are completely independent of each other.

Reference types: object, function, array are reference. Let’s have an example:

let a = {value:5};
let b = a;
a.value = 15;
console.log(b)// {value:15}
console.log(a) //…

If your mindset becomes a web developer. You must learn javascript whether you like it or not.

what is javascript?

Well, javascript is a multi-paradigm, single thread, interpreted, dynamic language with types and operators, standard built-in objects, and methods.

every programming languages have a building block. In javascript types is the main building block. Javascript’s common data types are Number, String, Object, Boolean, Function, Array, Null, Undefined and Symbol.

Today, we discuss javascript common data type Array and Array methods. Arrays are list-like objects whose prototype has methods to perform traversal and mutation operations. Neither the length of a JavaScript…

Nurul Alam

An enthusiast JavaScript and React developer.

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