Javascript Articles

Page 269 of 534

Mixins in JavaScript

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 3K+ Views

Multiple-inheritance is not supported by JavaScript by default. But sometimes we need to mix multiple object properties into a single object. Object property sharing can be done using mixins. In this article, we shall cover what are mixins in JavaScript. The definition of mixins can be stated as mixins is a class that contains methods that can be used by other classes without inheriting from that class. The methods in mixin provide certain behavior which is not used alone but can be used to add these behaviors to other classes. Basic Mixin with Object.assign() See the following ...

Read More

How to create tabs with CSS and JavaScript?

Aman Kumar
Aman Kumar
Updated on 15-Mar-2026 6K+ Views

In this article, we are going to discuss how to create tabs with CSS and JavaScript. Tabs are containers whose main purpose is to show and navigate through the diverse content of the website. Tabs are commonly used to manage the space and make the website more user-friendly without reloading too many times. The content in these tabs are usually closely related but mutually exclusive. There are several types of tabs which can be created and used in various cases: Horizontal tabs Horizontal with Secondary Tabs Frameless ...

Read More

How to create a responsive slideshow with CSS and JavaScript?

Aman Kumar
Aman Kumar
Updated on 15-Mar-2026 3K+ Views

In this article, we will create a responsive slideshow using JavaScript and CSS. A responsive slideshow is an interactive design element that displays a series of images with navigation controls, adapting to different screen sizes. A responsive slideshow allows users to browse through multiple images using arrow buttons or dot indicators. It's commonly used to showcase content while conserving space on web pages. HTML Structure First, create the HTML structure with a container for slides, navigation arrows, and dot indicators: 1 / 3 ...

Read More

JavaScript Detecting a mobile browser

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 257 Views

Detecting mobile browsers in JavaScript is essential for responsive web design and providing device-specific functionality. This can be achieved using the navigator.userAgent property to identify mobile device patterns. Basic Mobile Detection The most common approach uses regular expressions to check the user agent string for mobile device identifiers: Mobile Detection body { font-family: "Segoe ...

Read More

How to create a form with multiple steps in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 1K+ Views

Creating multi-step forms improves user experience by breaking complex forms into manageable sections. This approach reduces form abandonment and makes data collection more organized. Complete Multi-Step Form Example Here's a complete implementation of a multi-step registration form with validation and progress indicators: * { box-sizing: border-box; } body { background-color: #f1f1f1; } #regForm { margin: 100px auto; ...

Read More

Implementing Linear Search in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 517 Views

Linear search is a simple algorithm that sequentially checks each element in an array until the target element is found or the end of the array is reached. It has a time complexity of O(n) in the worst case. How Linear Search Works Linear Search Process Array: [1, 19, 5, 11, 22, 55] Target: 22 1 i=0 19 i=1 ...

Read More

How to add and remove names on button click with JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 3K+ Views

JavaScript allows you to dynamically add and remove names from a list using DOM manipulation methods. This functionality is commonly used in todo lists, user management interfaces, and interactive forms. HTML Structure First, we need a basic HTML structure with an input field, buttons, and a container for the names list: Add and Remove Names body { ...

Read More

Create increment decrement plus minus buttons programmatically for HTML input type number in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 16K+ Views

In JavaScript, you can create increment and decrement buttons for HTML input type number using the stepUp() and stepDown() methods. This approach provides better user experience by allowing precise control over numeric inputs. On clicking Increment (+), the number in the input field increases by the step value On clicking Decrement (-), the number in the input field decreases by the step value The buttons respect the min/max constraints of the input field Basic Implementation Here's how to create increment/decrement buttons programmatically: ...

Read More

How to find duplicate values in a JavaScript array?

Abhishek
Abhishek
Updated on 15-Mar-2026 73K+ Views

In this tutorial, we will discuss how we can find duplicate or repeating values in a JavaScript array using different methods or approaches to reach the solution to this problem. Below is the list of the approaches or methods we can use to solve the problem of finding duplicates − By simply Traversing the Array Using the filter() and indexOf() Methods Using the Set object and has() Method Let us discuss all of the above approaches to find duplicates in the JavaScript array − By Simply Traversing the Array Traversing the array using ...

Read More

How can I remove the decimal part of JavaScript number?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 47K+ Views

In this tutorial, we will learn to remove the decimal part of the number in JavaScript. While working with JavaScript, many times, developers need to play with the numbers stored in the database and needs to convert float and double numbers into the pure decimal or integer number. In this situation, developers can have multiple methods to truncate the decimal part of the number. We will see different approaches to overcome the above problem. Using the Math.trunc() method Using the Bitwise operators Using the Math.ceil() ...

Read More
Showing 2681–2690 of 5,340 articles
« Prev 1 267 268 269 270 271 534 Next »
Advertisements