Javascript

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…

Recursively Flatten JavaScript Array

I have started a series on the recursive problem with visualisation so that It’s easy to understand. In this problem, I will show you how to flat nested array objects using javaScript with visualisation. Let’s suppose you have …

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…

How to mock DOM element in Javascript/JQuery using Jest

Jest is a JavaScript testing framework maintained by Facebook, Inc. designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, No…

Mocking Specific module functions in JEST

Jest is a JavaScript testing framework maintained by Facebook, Inc. designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, No…

Testing JavaScript Event Listeners with Jest

Jest is a JavaScript testing framework maintained by Facebook, Inc. designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, Nod…

How to mock jQuery calls with Jest with real world example

Jest is a JavaScript testing framework maintained by Facebook, Inc. designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, No…

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