Javascript

Jest Testing Advanced Tutorials With Live Example

Testing is a significant part of any software development. Testing helps detect the bug early and reduces the testing time. Earlier, we only focused on backend testing, but nowadays, there are a lot of frameworks available for fr…

How to mock/test IntersectionObserver using JEST

The Intersection Observer API provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document’s viewport-Mozila Let’s write a simple javascript …

How to measure time taken by a function to execute

In this post, I will show you how to measure the execution time of any function in Javascript. Javascript console api have two functions console.time and console.timeEnd . console.time - start the timer console.timeEnd …

How to randomize (shuffle) a JavaScript array?

In this article, I will show you how to shuffle an array in javascript. Suffling or randomization is used in security or game design. To shuffle or randomize the item, we need an efficient algorithm. Here We will use The modern v…

Everything you show know about ES6 `let` keyword.

Everything you show knows about ES6 let keyword. Both var and let are used to declare variables in javascript, but the difference is that var is function scoped and let is block scoped. In this article, we will see the diffe…

ES6 JavaScript: Understanding Let & Const

Variables can be declared using const in the same way that var or let declarations are. The const keyword turns a variable into a constant whose value cannot be changed. The scoping rules for const variables are the same as t…

Flood fill algorithm in javascript

Flood fill , also called seed fill , is an algorithm that determines and alters the area connected to a given node in a multi-dimensional array with some matching attribute. It is used in the “bucket” fill tool of paint programs…

JavaScript Prototype Inheritance

In this article, I will show you how to implement inheritance in javascript. To understand the inheritance, let's get familiar with some terms. __proto__ property Every object in Javascript has its own secret, an interna…

Reusable Countdown Timer Using HTML5 Web Components & JavaScript

In this blog post, I will show you what HTML web 5 components with real-world examples is. By the end of the blog post, you will learn the following things. What are HTML5 Web Components? What are the different events of the …

Recursively Flatten JavaScript Array

I have started a series of recursive problems. I will show you how to flatten the javascript array in this problem. This example is for nested array objects. I have added the visualization, which will help understand the recurs…

Find All the Prime Factors of a Number-JavaScript

The process of determining which prime numbers multiply together to produce the original number is known as “prime factorization.” Algorithm Example - What are the prime factors of 12? We will start with the smallest prime num…

Difference Between var and let in JavaScript

Difference between var and  ES6 let keyword. Both var and let are used to declare variables in javascript, but the difference is that var is function scoped and let is block scoped. In this article, we will see the differenc…

Minimum coin change problem using recursion in JavaScript

You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the fewest number of coins that you need to make up that amount . If …

Binary search tree using JavaScript ES6-Typescript

A binary search tree is a data structure composed of nodes. Each node has a key, which determines the node’s position in the tree. (The node may also have a “value” field, where additional data is stored.) … Specifically, eac…

تحميل المزيد من المشاركات
لم يتم العثور على أي نتائج