Articles on Trending Technologies

Technical articles with clear explanations and examples

How to create an Ellipse with text cursor on hover over objects using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 266 Views

In this tutorial, we are going to create an Ellipse with a text cursor on hover over objects using FabricJS. text is one of the native cursor styles available which can be used in the FabricJS canvas too. FabricJS provides various types of cursors like default, all-scroll, crosshair, col-resize, row-resize etc. which are reusing the native cursor underhood. The hoverCursor property sets the style of the cursor when hovered over a canvas object. Syntax new fabric.Ellipse({ hoverCursor: String }: Object) Parameters options (optional) ...

Read More

How to create a Textbox with help cursor on moving objects using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 247 Views

In this tutorial, we are going to create a Textbox with a help cursor on moving objects using FabricJS. help is one of the native cursor styles available which can be used in the FabricJS canvas too. FabricJS provides various types of cursors like default, all scroll, crosshair, col-resize, row-resize, etc., which are reusing the native cursor underhood. The moveCursor property sets the style of the cursor when the object is moved around in the canvas. Syntax new fabric.Textbox(text: String, { moveCursor: String }: Object) Parameters ...

Read More

How to get the length of a string in bytes in JavaScript?

Prince Varshney
Prince Varshney
Updated on 15-Mar-2026 3K+ Views

In JavaScript, getting the length of a string in bytes is different from getting its character count. A byte is a unit of data that is 8 binary bits long, and while most ASCII characters use 1 byte, Unicode characters like emojis or special symbols may use multiple bytes. Here are examples of strings and their byte lengths: Examples: "JavaScript" → 10 bytes (each ASCII character = 1 byte) "20€" → 5 bytes (€ symbol uses 3 bytes in UTF-8) "Tutorials Point" → 15 bytes There ...

Read More

Find all occurrences of a word in array in JavaScript

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

When working with arrays in JavaScript, you might need to find how many elements contain a specific word or substring. This article demonstrates multiple approaches to count occurrences of a word within array elements. Problem Statement We need to write a JavaScript function that takes an array of strings as the first argument and a search word as the second argument. The function should return the count of array elements that contain the specified word. Method 1: Using filter() and indexOf() This approach uses filter() to find matching elements and returns the length of the filtered ...

Read More

Insert a number into a sorted array of numbers JavaScript

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

We are required to write a JavaScript function that takes in a sorted array of numbers as the first argument and a single number as the second argument. The function should push the number specified as the second argument into the array without distorting the sorting of the elements. We are required to do this without creating another array. Approach: Binary Search with In-Place Insertion The solution uses binary search to find the correct insertion position, then shifts elements using a swapping technique to maintain order without extra space. Example const arr = ...

Read More

Finding minimum number of required operations to reach n from m in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 244 Views

We are required to write a JavaScript function that takes in two numbers, m and n, as the first and the second argument. Our function is supposed to count the number of minimum operations required to reach n from m, using only these two operations: Double − Multiply the number on the display by 2, or; Decrement − Subtract 1 from the number on the display. ...

Read More

How to create an Ellipse with wait cursor on hover over objects using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 271 Views

In this tutorial, we are going to create an Ellipse with a wait cursor on hover over objects using FabricJS. wait is one of the native cursor styles available, which can be used in the FabricJS canvas too. FabricJS provides various types of cursors like default, all-scroll, crosshair, col-resize, row-resize etc. which are reusing the native cursor underhood. The hoverCursor property sets the style of the cursor when hovered over a canvas object. Syntax new fabric.Ellipse({ hoverCursor: String }: Object) Parameters options (optional) ...

Read More

How to create a Textbox with progress cursor on moving objects using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 218 Views

In this tutorial, we are going to create a Textbox with a progress cursor on moving objects using FabricJS. progress is one of the native cursor styles available which can be used in the FabricJS canvas too. FabricJS provides various types of cursors like default, all-scroll, crosshair, col-resize, row-resize, etc., which are reusing the native cursor under the hood. The moveCursor property sets the style of the cursor when the object is moved around in the canvas. Syntax new fabric.Textbox(text: String, { moveCursor: String }: Object) Parameters ...

Read More

How can a particular frame be targeted, from a hyperlink, in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 662 Views

HTML frames provide a convenient way to divide a browser window into multiple sections, where each section can load a separate HTML document. JavaScript allows you to target and manipulate specific frames using several methods through the window.frames property and DOM manipulation. The frames property is an array-like object containing all the frames (including iframes) on the current page. Here are the main approaches to target a particular frame: Method 1: Using Frame Index You can target a specific frame by its index position in the frames collection. The first frame has index 0: // ...

Read More

Check if a string is entirely made of the same substring JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 428 Views

In JavaScript, you can check if a string is entirely made of repeated substrings using various approaches. This is useful for pattern validation and string analysis. The problem requires that the string consists of a repeated character sequence with at least one repetition. For example, "aa" contains two "a" substrings, "abcabcabc" contains three "abc" substrings, but "ababa" fails because it has an extra character. Examples of Valid and Invalid Patterns "aa" should return true because it entirely contains two strings "a" "aaa" should return true because it entirely ...

Read More
Showing 14641–14650 of 61,297 articles
Advertisements