Null vs Undefined

Undefined: Undefined means that, a variable is declared but not assigned any value.
Null: It’s an assignment value. It can be assigned to a variable as a representation of no value.
Null and undefined are equal in value but different in type.

null == undefined // true
null === undefined // false

Truthy and Falsy values

All values are truthy unless they are defined as falsy.
Truthy values:
Falsy values:

Double Equal(==) vs Triple Equal(===)

Double Equal only check the values but Triple Equal check…

React is a JavaScript library for building user interfaces. It’s used to design web apps. It is a declarative language for HTML UIs that represent dynamic data. It creates a virtual DOM and manipulates the HTML DOM in any UI changes.

Raw Code vs React Code:

with web DOM API

document.getElementById(‘title’).innerHTML = `
Hello HTML

with React’s API

'Hello React',

Getting Started

To create a react app, open the terminal in a specific directory.

npx create-react-app your-app

after finished the process:

cd your-app
npm start

Folder Structure

index.html [This…

As a programmer /developer, our code must be as clean and easy to read. We need to write comments to understand the codes for others.

Coding Style

function pow(num, sup) {
let result = 1;
for (let i = 0; i < sup; i++){
result *= number;

return result;
let num= prompt("x?", "");
let sup= prompt("n?", "");
if(num < 0) {
alert(`${num} is not valid,
please enter a non-negative integer number`);
} else {
alert( pow(num, sup) );

Curly Braces

Bad practice of writing JavaScript code:-

if (n < 0) {alert(‘${num} is not valid’);}
if (n < 0)
alert(‘${num} is not…

1) Always we use the toUpperCase() or, toLowerCase() method to convert a string into capital or smaller letter. But, if we need to convert only the first letter into the capital letter, we need to use:-

const name = ‘badhan’;console.log(name[0].toUpperCase() + name.substr(1, name.length));or,newName = name[0].toUpperCase() + name.substr(1, name.length);console.log(newName);

2) To check whether a word is present or, not,

const sentence = ‘The quick brown fox jumps over the lazy dog’;console.log(sentence.includes(cat)); //falseconsole.log(sentence.includes(dog)); //true

3) To remove Unnessacery white space of any user input,

const input = ‘ This is JS Magic ’;console.log(input.trim()); //This is JS Magic

4) Easy Way to concate two string

const str1 = ‘Hello’;const str2 = ‘World’;console.log(str1.concate(‘ ’ ’, str2));Easy Way: console.log(str1 + ‘ ‘ ’ + str2);

5) Delete a specific element from an array in JavaScript Array:

const name = [ Badhan, Aakash, KKK, Puja, Chalantica ];name.splice( name.indexOf(‘KKK’), 1 );console.log(name);

6) Clear concept about split(), slice() and replace :-

split() can convert a string into an array of sub-stringconst sentence = ‘The quick brown fox jumps…

Badhan Chandra Barman

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