Articles on Trending Technologies

Technical articles with clear explanations and examples

Tutorix - AI Tutor

How many ways can a property of a JavaScript object be accessed?

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

JavaScript object properties can be accessed in two main ways: dot notation and bracket notation. Each method has its own use cases and advantages. Dot Notation The dot notation is the most common and readable way to access object properties when the property name is known at compile time. object.propertyName Bracket Notation The bracket notation uses square brackets with the property name as a string. This method is more flexible and allows dynamic property access. object["propertyName"] object[variableName] Example: Using Dot Notation var person = ...

Read More

What's the best way to open new browser window using JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 349 Views

The window.open() method is the standard way to open new browser windows in JavaScript. It provides control over window features and behavior. Syntax window.open(url, name, features) Parameters url: The URL to open (optional) name: Window name or target (optional) features: Window features like size, position, toolbar (optional) Basic Example Open New Window body { ...

Read More

How to find the one integer that appears an odd number of times in a JavaScript array?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 372 Views

We are given an array of integers and told that all the elements appear for an even number of times except a single element. Our job is to find that element in single iteration. Let this be the sample array: [1, 4, 3, 4, 2, 3, 2, 7, 8, 8, 9, 7, 9] Understanding XOR Operator Before attempting this problem, we need to understand a little about the bitwise XOR (^) operator. The XOR operator returns TRUE if both the operands are complementary to each other and returns FALSE if both the operands ...

Read More

JavaScript to push value in empty index in array

Disha Verma
Disha Verma
Updated on 15-Mar-2026 2K+ Views

To push value in an empty index in an array, we can create a custom method that finds the first empty slot and fills it, or appends to the end if no empty slots exist. Arrays in JavaScript can have empty slots (also called sparse arrays) where certain indexes are undefined. When working with such arrays, you might need to fill these gaps before adding new elements at the end. Understanding Empty Slots in Arrays Empty slots occur when you skip indexes during array creation or deletion: const arr = [1, 2, , 4, , ...

Read More

How to Compare Two Arrays in JavaScript?

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

In JavaScript, comparing arrays with == or === operators doesn't work as expected because they compare object references, not actual array contents. This article explores multiple effective methods to properly compare two arrays in JavaScript. When we try to compare arrays directly, JavaScript compares memory references rather than the array elements themselves, which typically results in false even for identical arrays. Why Direct Comparison Fails const arr1 = [1, 2, 3]; ...

Read More

How to print content of JavaScript object?

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

In this tutorial, we will learn to print the content of a JavaScript object. Objects are similar to variables, but they can contain many values. Javascript object values are written as key: value pairs, and each pair is separated by commas. It is used to access data from databases or any other sources. Following are the ways to print the content of JavaScript objects − Using the JSON.stringify() Method Using Object.values() Using a for-in loop Using JSON.stringify() Method The JSON.stringify() method converts JavaScript objects ...

Read More

Get maximal GPS precision on mobile browser

Vrundesha Joshi
Vrundesha Joshi
Updated on 15-Mar-2026 396 Views

Getting accurate GPS location in mobile browsers requires understanding browser limitations and implementing best practices. Different browsers and devices provide varying levels of precision. Browser Limitations Built-in Android browsers restrict GPS accuracy for security and privacy reasons. Even when location permissions are granted, the precision may be limited to protect user privacy. Getting High Precision Location Use the Geolocation API with enableHighAccuracy option: GPS Precision Test Get High Precision Location ...

Read More

Usage of CSS caption-side property

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

The caption-side property controls the position of a table's element relative to the table content. This CSS property allows you to place captions on any side of the table for better visual organization. Syntax caption-side: top | bottom | left | right | initial | inherit; Property Values Value Description top Caption appears above the table ...

Read More

How to set dynamic property keys to an object in JavaScript?

Lokesh Yadav
Lokesh Yadav
Updated on 15-Mar-2026 3K+ Views

Setting dynamic property keys allows you to create object properties with names that are determined at runtime. JavaScript provides three main approaches to accomplish this. Method 1: Bracket Notation The simplest way is using bracket notation to assign a value to a dynamically named property: Dynamic Property Keys - Bracket Notation Setting Dynamic Property Keys using Bracket Notation let Employee = { ...

Read More

How to toggle between password visibility with JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 345 Views

To toggle between password visibility with JavaScript, you can change the input type between "password" and "text" using a checkbox or button. This allows users to see their password when needed. How It Works The toggle functionality works by: Adding an event listener to a checkbox or button Checking the current input type Switching between "password" and "text" types Example: Using Checkbox Toggle Password Toggle Example Password Visibility Toggle ...

Read More
Showing 17001–17010 of 61,298 articles
Advertisements