Articles on Trending Technologies

Technical articles with clear explanations and examples

Tutorix - AI Tutor

How to prevent modification of object in JavaScript ?.

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 515 Views

JavaScript provides three methods to prevent modification of objects at different levels of restriction. These protective measures ensure that objects cannot be accidentally or intentionally altered, maintaining code integrity and predictable behavior. Three Levels of Object Protection 1) Prevent Extensions Object.preventExtensions() prevents new properties from being added to an object, but existing properties can still be modified or deleted. Example var object1 = { prop1: 1 }; Object.preventExtensions(object1); delete ...

Read More

Regular functions vs Arrow functions in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 715 Views

Arrow functions and regular functions are both ways to define functions in JavaScript, but they have important differences in behavior. Understanding these differences helps you choose the right function type for your needs. Syntax The syntax differs between regular and arrow functions: Arrow Function Syntax let x = (params) => { // code }; Regular Function Syntax let x = function functionName(params) { // code }; Usage of "this" Keyword The most significant difference is how they handle the this ...

Read More

How to convert a string to camel case in JavaScript?

Ayush Gupta
Ayush Gupta
Updated on 15-Mar-2026 2K+ Views

Camel case is the practice of writing phrases such that each word or abbreviation in the middle of the phrase begins with a capital letter, with no intervening spaces or punctuation. For example, "Concurrent hash maps" in camel case would be written as: ConcurrentHashMaps There are different variations of camel case: PascalCase (first letter capitalized) and camelCase (first letter lowercase). We'll explore multiple methods to convert strings to camel case in JavaScript. Method 1: Using split() and map() function camelize(str) { // Split the string at all space characters ...

Read More

Highlight a text, every time page loads with JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 393 Views

To highlight text every time a page loads in JavaScript, you can use a for loop to iterate through words and wrap specific words in elements with CSS classes for styling. Approach The technique involves: Getting the text content using getElementById() Splitting the text into an array of words using split(" ") Looping through each word to find matches Wrapping matching words with tags Rejoining the array and updating the HTML content Example Text ...

Read More

Share methods in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 742 Views

Methods can be shared across multiple object instances by attaching them to the prototype property. This approach ensures all instances of a constructor function share the same method, making memory usage more efficient than defining methods inside the constructor. Basic Prototype Method Sharing When you define a method on the prototype, all instances created from that constructor function can access it: Shared Methods Shared Methods in JavaScript ...

Read More

Convert number to alphabet letter JavaScript

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

We are required to write a function that takes in a number between 1 and 26 (both inclusive) and returns the corresponding English alphabet for it. (capital case) If the number is out of this range return -1. For example: toAlpha(3) = C toAlpha(18) = R The ASCII Codes ASCII codes are the standard numerical representation of all the characters and numbers present on our keyboard and many more. The capital English alphabets are also mapped in the ASCII char codes, they start from 65 and go all the way up to 90, ...

Read More

Sum of consecutive numbers in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 622 Views

Let's say, we have to write a function that takes in an array and returns another array in which the consecutive similar numbers are added up together. For example − const array = [1, 5, 5, 5, 8, 8, 9, 1, 4, 4, 2]; console.log("Original array:", array); Original array: [ 1, 5, 5, 5, 8, 8, 9, 1, 4, 4, 2 ] The output should be − [1, 15, 16, 9, 1, 8, 2] All consecutive 5s added up to 15, then 2 consecutive 8s added up to ...

Read More

Set whether the flexible items should wrap or not with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 270 Views

In this tutorial, we will learn how to control whether flexible items should wrap or not using JavaScript's flexWrap property. The flexWrap property determines if flex items should wrap to new lines when there isn't enough space in the container. This is essential for creating responsive layouts. Using the Style flexWrap Property The flexWrap property defines whether flex items wrap within their container. The container must have display: flex for this property to work. The default value is nowrap. Syntax object.style.flexWrap = "nowrap|wrap|wrap-reverse|initial|inherit" Values nowrap − Items will not wrap ...

Read More

Playing a WAV file on iOS Safari

Nancy Den
Nancy Den
Updated on 15-Mar-2026 641 Views

Playing WAV files on iOS Safari requires specific HTTP headers to ensure proper audio streaming and playback compatibility. Required Headers for iOS Safari iOS Safari needs these HTTP headers to properly handle WAV file playback: Content-Range: bytes 0-1023/2048 Content-Type: audio/wav Accept-Ranges: bytes Content-Length: 2048 Complete Server Implementation Here's a Node.js example showing how to serve WAV files with proper headers: const express = require('express'); const fs = require('fs'); const path = require('path'); const app = express(); app.get('/audio/:filename', (req, res) => { const filename = req.params.filename; ...

Read More

Usage of CSS list-style-image property

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 156 Views

The list-style-image CSS property allows you to replace default list markers (bullets or numbers) with custom images. This property is commonly used to create visually appealing lists with custom icons or graphics. Syntax list-style-image: url(image-path) | none | inherit; Parameters Value Description url() Specifies the path to the image file none No image is used (default behavior) inherit Inherits the value from parent element Example: Basic Usage ...

Read More
Showing 17671–17680 of 61,298 articles
Advertisements