Javascript Algorithms Articles

Sorted By: Most Recent
Chris Cook Chris Cook
Updated on October 09, 2024

How to Check for Log Errors With Jest

There are two ways to check for log errors with the JavaScript testing framework Jest: jest.fn() or jest.spyOn(). Here’s how to do it, with code.  

Image: Shutterstock / Built In
Yordan Ramchev Yordan Ramchev
Updated on October 08, 2024

How to Auto Import Vue Components in JavaScript

Setting up on-demand auto importing for Vue components makes it easier to eliminate typos in import paths and reduces final production build size. Learn more.

Image: Shutterstock / Built In
Shahar Polak Shahar Polak
Updated on October 07, 2024

How to Stop a ForEach Loop in JavaScript

A JavaScript forEach loop is a control flow statement that iterates through arrays. It can be stopped by throwing an error. Learn more.

Image: Shutterstock / Built In
Jayanth Somineni Jayanth Somineni
Updated on September 27, 2024

How to Remove Duplicates From a JavaScript Array

When you need to remove duplicates from an array in JavaScript, consider these methods.

Image: Shutterstock / Built In
Michelle Wong Michelle Wong
Updated on September 13, 2024

Switch Case vs. If-Else in JavaScript Explained

Switch case and if-else offer two different approaches to writing conditional statements in JavaScript. Here’s how to determine which one to use.

Image: Shutterstock / Built In
Harshil Patel Harshil Patel
Updated on September 04, 2024

Quicksort Algorithm: An Overview

Quicksort is a sorting algorithm that uses a divide-and-conquer strategy to split and sort an array. It has a time complexity of O nlogn.

Image: Shutterstock / Built In
Akshay Kumar Akshay Kumar
Updated on July 11, 2024

Top 50 JavaScript Interview Questions With Example Answers

Review these common JavaScript interview questions and answers and practice your coding fundamentals with this guide to ace your next interview.

Image: Shutterstock / Built In
Navya Arora Navya Arora
Updated on June 07, 2024

Document Ready Method in JavaScript: A Guide

The document ready method ensures that a section of JavaScript code only runs once the document object model (DOM) is ready. Here’s how to do it in JavaScript without jQuery.

Image: Shutterstock / Built In
K. Jagathish K. Jagathish
Updated on June 06, 2024

How to Check If a Checkbox Is Checked in JavaScript and jQuery

There are a few common methods to determine if a checkbox is checked in JavaScript and jQuery, including: the checked property, :checked selector and the prop() method. Learn more.

Image: Shutterstock / Built In
Sanchitha Sharma Sanchitha Sharma
Updated on May 13, 2024

How to Convert a JavaScript String to a Number

Converting a JavaScript string into a number is useful for comparing numerical data that comes in string format and completing math operations. Here are seven methods to do it.

Image: Shutterstock / Built In