Articles on Trending Technologies

Technical articles with clear explanations and examples

Is there any way to embed a PDF file into an HTML5 page?

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

To embed a PDF file in an HTML5 page, you can use several methods. The most common approaches are using the element, element, or element. Using iframe Element (Most Common) The element is the most widely supported method for embedding PDFs: Embed PDF with iframe PDF Embedded with iframe Your browser does not support iframes. ...

Read More

Two way communication between the browsing contexts in HTML5

Rishi Rathor
Rishi Rathor
Updated on 15-Mar-2026 443 Views

Two-way communication between browsing contexts in HTML5 is achieved through Channel Messaging API. This allows secure communication between different origins, iframes, web workers, and windows. The MessageChannel creates two connected ports that can send messages to each other. When you create a MessageChannel, it internally generates two ports - one for sending data and another that gets forwarded to the target browsing context. Key Methods postMessage() − Posts the message through the channel start() − Starts listening for messages on the port close() − Closes the communication ports Basic Syntax // Create ...

Read More

Usage of border-top-style property in CSS

Samual Sam
Samual Sam
Updated on 15-Mar-2026 181 Views

The border-top-style property changes the style of the top border of an element. This CSS property allows you to define different visual styles for the top border, such as solid, dashed, dotted, and more. Syntax border-top-style: value; Available Values The border-top-style property accepts the following values: none - No border (default) solid - A solid line dashed - A dashed line dotted - A dotted line double - Two solid lines groove - A 3D grooved border ridge - A 3D ridged border inset - A 3D inset border outset - A ...

Read More

Removing an element from the start of the array in javascript

Sai Teja Kotha
Sai Teja Kotha
Updated on 15-Mar-2026 239 Views

In JavaScript, there are several methods to remove the first element from an array. The most common approaches are using the shift() method, slice() method, or the Underscore.js _.rest() method. Using shift() Method (Recommended) The shift() method removes and returns the first element from an array, modifying the original array. Syntax array.shift() Example Remove first element using shift() ...

Read More

Add a method to a JavaScript object constructor?

Vivek Verma
Vivek Verma
Updated on 15-Mar-2026 3K+ Views

In JavaScript, adding a method (function) to a constructor is different from adding a method to a regular object. To add a method to a constructor, we need to define it inside the constructor or in its prototype (using which JavaScript objects inherit features from one another). We can create an object in the following ways in JavaScript: Using the function Constructor (older way): function person(){ } const p = new person(); Using ES6 Class Syntax (i.e., modern way): class person{ constructor(){} } const p = new person(); ...

Read More

Object literals vs constructors in JavaScript

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

Object literals and constructors are two fundamental ways to create objects in JavaScript. Object literals create singleton objects, while constructor functions can create multiple instances with shared behavior. Object Literal Notation Object literals use curly braces {} to define properties and methods directly. They are ideal for creating single-use objects or configuration objects. Object Literal Example const userDetails = { name: "Aman", ...

Read More

Does JavaScript support block scope?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 291 Views

JavaScript supports block scope for variables declared with let and const, but not for variables declared with var. Understanding this difference is crucial for writing predictable JavaScript code. What is Block Scope? Block scope means a variable is only accessible within the curly braces {} where it was declared. This includes if statements, for loops, while loops, and any other code blocks. Variables with let and const (Block Scoped) Variables declared with let and const are confined to their block: Block Scope with let/const ...

Read More

How to generate child keys by parent keys in array JavaScript?

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

Let's say, we have an array of objects representing a hierarchical structure where each object has an id, parent_id, and title: const arr = [ { id: 1, parent_id: 0, title: 'Movies' }, { id: 2, parent_id: 0, title: 'Music' }, { id: 3, parent_id: 1, title: 'Russian movies' }, { id: 4, parent_id: 2, title: 'Russian music' }, { id: 5, parent_id: 3, title: 'New' }, { id: 6, parent_id: 3, title: 'Top10' ...

Read More

Set JavaScript object values to null?

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

Setting object values to null can help reset data, free up memory, or show that a value is no longer needed. In JavaScript, the null value is used to indicate that there is an intentional absence of any object value. This article provides various methods for setting JavaScript object values to null and what that means. Setting an Object's Values to null Setting object values to null can be done in two types: For Specific Object Value For Multiple Object Values For Specific Object Value ...

Read More

How to test if a JavaScript cookie has expired?

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

To test if a JavaScript cookie has expired, you need to check if the cookie exists or returns null. When a cookie expires, the browser automatically removes it, so attempting to access it will return null or undefined. Using document.cookie (Vanilla JavaScript) The most straightforward approach is to create a helper function that checks if a cookie exists: function getCookie(name) { const cookies = document.cookie.split(';'); for (let cookie of cookies) { const [cookieName, cookieValue] = cookie.trim().split('='); ...

Read More
Showing 17301–17310 of 61,297 articles
Advertisements