Articles on Trending Technologies

Technical articles with clear explanations and examples

Searching for values in an Javascript Binary Search Tree

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

We're going to use the property of a BST to look up elements in it. In a Binary Search Tree, values smaller than the current node are in the left subtree, and values larger are in the right subtree, making search operations efficient. Iterative Search Implementation The iterative approach uses a loop to traverse the tree: searchIter(data) { let currNode = this.root; while (currNode !== null) { if (currNode.data === data) { ...

Read More

What is importance of startsWith() method in JavaScript?

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

To check whether a string starts with a particular character or substring, the indexOf() method was traditionally used. However, ES6 introduced the more intuitive and readable startsWith() method, which is specifically designed for this purpose and offers better performance and clarity. Traditional Approach: Using indexOf() The indexOf() method returns the first index where a substring is found. To check if a string starts with specific characters, we compare the result with 0: var text = 'Tutorialspoint'; document.write(text.indexOf('T') === 0); true ...

Read More

How to create a length converter with HTML and JavaScript?

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

To create a length converter with HTML and JavaScript, you'll need to combine HTML form elements with JavaScript functions to handle the conversion logic. This tutorial demonstrates building a simple kilometer-to-meter converter. HTML Structure The converter uses an input field for kilometers and displays the converted meters value. The oninput and onchange events trigger the conversion function automatically as you type. Complete Example body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; padding: 20px; ...

Read More

JavaScript program to retrieve clients IP address

Shriansh Kumar
Shriansh Kumar
Updated on 15-Mar-2026 1K+ Views

Internet Protocol address, in short, IP address, is a unique address represented by a string of numbers that identifies a device on the internet or a local network. In JavaScript, we can retrieve a client's IP addresses using 3rd party API services such as ipify or ipapi. We can then further use this information to track user locations, personalize content based on the location, or implement security measures. Understanding Client-Side IP Detection JavaScript running in the browser cannot directly access the client's IP address due to security restrictions. However, we can use external APIs that return the public ...

Read More

Remove any text not inside element tag on a web page with JavaScript?

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

To remove text nodes that are not inside HTML element tags, we use jQuery's contents() and filter() methods to identify text nodes, then remove() to delete them. Understanding Text Nodes vs Element Nodes In the DOM, there are different node types: Element nodes (nodeType = 1): HTML tags like , Text nodes (nodeType = 3): Plain text content not wrapped in tags Example HTML Structure Consider this HTML where we want to remove the unwrapped text: Demo Program This is also Demo Program The text "This is also Demo ...

Read More

How do I trigger a function when the time reaches a specific time in JavaScript?

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

To trigger a function at a specific time in JavaScript, calculate the time difference between the current time and target time, then use setTimeout() with that delay. Basic Approach Extract the target time, calculate the milliseconds until that time, and schedule the function execution: Trigger Function at Specific Time Function will trigger at specified time Waiting for target time... ...

Read More

Splitting string into groups – JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 444 Views

Given a string S, consisting of alphabets, numbers and special characters. We need to write a program to split the strings in three different strings S1, S2 and S3, such that − The string S1 will contain all the alphabets present in S, The string S2 will contain all the numbers present in S, and S3 will contain all special characters present in S. The strings S1, S2 and S3 should have characters in the same order as they appear in input. Syntax const ...

Read More

What to do with content that renders outside the element box with JavaScript?

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

When content exceeds an element's dimensions, it can overflow outside the visible area. JavaScript provides several ways to handle this using the overflow property, which controls how overflowing content is displayed. Understanding Overflow Values The overflow property accepts several values: visible - Default behavior, content flows outside the box hidden - Clips content that overflows scroll - Always shows scrollbars auto - Shows scrollbars only when needed Example: Dynamic Overflow Control Here's a complete example demonstrating how to manage overflow with JavaScript: ...

Read More

How to make an Ember.js app offline with server sync when available?

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 173 Views

Making an Ember.js app work offline with server synchronization requires implementing client-side storage that can sync data when connectivity is restored. This enables users to continue working with your app even without internet access. Using LocalStorage Adapter The ember-localstorage adapter provides basic offline storage capabilities by storing data in the browser's localStorage: App.store = DS.Store.create({ revision: 11, adapter: DS.LSAdapter.create() }); Advanced Offline Storage with IndexedDB For more robust offline functionality, use IndexedDB which provides better performance and storage capacity: App.Store = DS.SyncStore.extend({ ...

Read More

HTML5 getCurrentPosition almost always failing in PhoneGap on iOS

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 145 Views

When using HTML5 geolocation in PhoneGap applications on iOS devices, getCurrentPosition may fail frequently, especially on iOS 6. This issue affects location-based functionality and requires specific configuration changes to resolve. The Problem PhoneGap's geolocation API generally works well on iOS, but iOS 6 introduced specific issues where getCurrentPosition consistently triggers the failure callback instead of successfully retrieving the device's location. PhoneGap Configuration Fix The primary solution involves modifying the PhoneGap.plist file configuration: // In PhoneGap.plist, set the geolocation setting to: GeolocationEnabled: NO Setting this value to YES causes memory problems on iOS ...

Read More
Showing 18181–18190 of 61,297 articles
Advertisements