Truthy and Falsy values

Want to determine if a value is truthy or falsy? Then encounter it in boolean context. If it returns true then the value is truthy else it is falsy. Quite simple.

List of falsy values: false, 0, -0, 0n, “”, null, undefined and NaN. Except these all values are truthy unless you define them as falsy.

Some Truthy values:

if (true)
if ({})
if ([])
if (10)
if ("0")
if ("false")

Null and Undefined

Null: Itindicates that a variable points to no object that is the variable lack identification. Null can be set explicitly.

Undefined: A variable that has no value assigned to…

React is a javascript library that focuses on just one thing and that one thing is “Building user interfaces”. A UI is anything that lets a user interact with the machine. Since Web browsers understand JavaScript, we can use React to describe Web UIs.

React introduced and uses the concept of virtual DOM. Document Object Model is the browsers’ programming interface for HTML.

Virtual Dom:

In normal DOM what happens is if we update anything in our UI it renders the whole DOM, which is costly. So React comes into the picture with Virtual DOM to make the process faster. There are…

In Javascript functions, the scope of the declared variables doesn’t depend upon the spot where the variable was created. Rather the way you declare the variables determines their scopes. ES6 offers options to make controlling scope easier.

Var Declarations and Hoisting

In js function, the scope of the variables declared using var is global scope regardless of the spot where the variables are created! This is called hoisting. The following example will make it more clear to you.

function checkScope(condition) {if (condition) {
var value = "blue";

In javascript, characters in a string are indexed from left to right. The indexing of the string starts from 0, and the index of the last character in a string is given by string.length -1.
if you are a junior Js developer then let us look at some useful string methods in javascript which you must know.

1. charAt()

In js, there are two ways to access an individual character in a string. The first is the charAt() method.

Syntax: charAt(index)

It returns the character at the the specified index.

For example,

const profession = ‘Computer Programmer’;return (profession.charAt(0)); …

C17_10_10 Mohammad Shabaj Khan

I am a MERN stack web developer trying to gain confidence using my potential in the field of “Web Development”.

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