Home » Javascript

Destructuring

destructuring

Destructuring Destructuring is a way to quickly extract data out of an {} or [] without having to write much code. ES5 Way let foo = [‘x’, ‘y’, ‘z’]; let a = foo[0]; let b = foo[1]; let…

Read More »

Basic javascript algorithms

js algorithms

Get uniq from array // get uniq from array const nums = [1, 2, 1, 1, 2, 1, 3, 4, 1 ]; const uniq = […new Set(numbers)]; // => [ 1, 2, 3, 4 ] const uniq2 =…

Read More »

JSON, n JSON method

json

The JSON (JavaScript Object Notation) is a general format to represent values and objects. JSON is the string form of object. Syntax: JSON.stringify(value[, replacer[, space]]) Parameters: Value The value to convert to a JSON string. Replacer Optional The…

Read More »

ES6 arrow functions

es6 arrow function

Arrow function taken from CoffeeScript (a transcompiled language). Arrow function, also called “fat arrow” functions. This is represented by => (Flat Arrow). It is anonymous and can change the way this bind into function. When we are using…

Read More »

Javascript function arguments handling

arguments

In javascript we don’t have any method to check our parameters and arguments. Earlier tutorial, We have learned that functions can have parameters; like- functionName(parameter1, parameter2, parameter3) { code to be executed } but suppose that we missed…

Read More »

Javascript function

functions

A function is a block of statements, which is used to perform a specific task.In javascript functions are defined with the function keyword. There are 3 ways to create a function. 1. by declaration. 2. by function expression. 3. by constructor. (good for…

Read More »

Loops

loops

Loops Allow to repeat block code, until the given condition is true. In Javascript we have three basics types loops are available – for while do while for loop // for for (var i = 0; i <…

Read More »

Secret of falsy value

falsy_value

As we know true and false are related to boolean data type. Zero, empty string, undefined, null, NaN are falsy values. All non-empty things and true are Truthy values. But going to deep inside into falsy value. We need…

Read More »

Conditions

conditions

If, else, switch are conditional statement. Condition statement change flow of the program according to test cases. So if block contain test expression inside parenthesis. if test expression is evaluated is true then body of if executed and…

Read More »

Type detection

type_detection

Type detection It is a way by which we can identify the type of data. We know that data type can be three type. So if we are working on data sometime we need to identify datatype of…

Read More »