Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
Integer Range in JavaScript
JavaScript uses a single number type to represent all numeric values, including both integers and floating-point numbers. Unlike languages such as C++ or Java, JavaScript doesn't have separate data types for different number sizes. However, there are important limits to understand when working with large integers. JavaScript stores numbers using the IEEE 754 double-precision floating-point format, which determines the maximum and minimum values that can be safely represented and manipulated. JavaScript Number System JavaScript treats all numbers as 64-bit floating-point values. This unified approach simplifies the language but introduces precision limitations when working with very large integers. ...
Read MoreThe n times dribbling strings in JavaScript
We are required to write a JavaScript function that takes in a string and a number, say n, and the function should return a new string in which all the letters of the original string are repeated n times. For example: If the string is − const str = 'how are you' And the number n is 2. Output Then the output should be − const output = 'hhooww aarree yyoouu' Therefore, let's write the code for this function − Using String.prototype.repeat() The most straightforward approach is to iterate through each ...
Read MoreHow to merge two arrays with objects in one in JavaScript?
Suppose, we have two arrays of objects like these − const arr1 = [ {name:'test', lastname: 'test', gender:'f'}, {name:'test1', lastname: 'test1', gender:'f'}, {name:'test2', lastname: 'test2', gender:'m'} ]; const arr2 = [ {name:'test21', lastname: 'test21', gender:'f'}, {name:'test1', lastname: 'test1', gender:'f'}, {name:'test2', lastname: 'test2', gender:'m'}, {name:'test22', lastname: 'test22', gender:'m'} ]; console.log("Array 1:", arr1); console.log("Array 2:", arr2); Array 1: [ { name: 'test', lastname: 'test', gender: 'f' }, { name: 'test1', lastname: 'test1', gender: 'f' }, { ...
Read MoreNth element of the Fibonacci series JavaScript
In this article, we'll learn how to find the nth element in the Fibonacci series using JavaScript. The Fibonacci sequence is a mathematical series where each number is the sum of the two preceding numbers. What is the Fibonacci Series? The Fibonacci sequence starts with 0 and 1, and each subsequent number is the sum of the previous two numbers. The series begins as: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89... For example, the 6th number in the series is 8, and the 10th number is 55. Using ...
Read MoreFinding all the Longest Strings from an Array in JavaScript
In the given problem statement we have to find all the longest strings from an array with the help of JavaScript functionalities. This task can be done by getting the length of each string and then comparing these lengths with the maximum length. Understanding the Problem The problem is to find all the longest strings from an array in JavaScript. We have an array of strings and our task is to identify the strings with maximum length and return them as a new array. For example: if we have an array ['abc', 'defg', 'hijkl', 'mnopqr', 'stuvwxyz'], the longest ...
Read MoreFinding one missing number in a scrambled sequence using JavaScript
We are required to write a JavaScript function that takes in an array of numbers containing numbers from 1 to n. The problem is that one number from the array goes missing and the array is not sorted as well. Our function should find and return that one number missing from the array. Problem Statement Given an array of numbers from 1 to n with one missing number, find the missing number. The array is not sorted and contains n-1 elements instead of n. Using Sum Formula Method The most efficient approach uses the mathematical formula ...
Read MoreHow to set the angle of rotation of an Ellipse using FabricJS?
In this tutorial, we are going to set the angle of rotation of an Ellipse using FabricJS. Ellipse is one of the various shapes provided by FabricJS. In order to create an ellipse, we have to create an instance of fabric.Ellipse class and add it to the canvas. The angle property in FabricJS defines the angle of 2D rotation of an object. We also have the centeredRotation property that allows us to use the center point of an ellipse as the origin of transformation. Syntax new fabric.Ellipse({ angle: Number, centeredRotation: Boolean }: Object) Parameters ...
Read MoreHow to add dashed stroke to a Triangle using FabricJS?
In this tutorial, we are going to learn how to add a dashed stroke to a Triangle using FabricJS. Triangle is one of the various shapes provided by FabricJS. In order to create a Triangle, we will have to create an instance of fabric.Triangle class and add it to the canvas. The strokeDashArray property allows us to specify a dash pattern for the object's stroke. Syntax new fabric.Triangle({ strokeDashArray: Array }: Object) Parameters options (optional) − This parameter is an Object which provides ...
Read MoreHow to lock the rotation of Textbox using FabricJS?
In this tutorial, we are going to learn how to lock the rotation of a Textbox using FabricJS. Just as we can specify the position, colour, opacity and dimension of a textbox object in the canvas, we can also specify whether we want to allow rotation or not. This can be done by using the lockRotation property. Syntax new fabric.Textbox(text: String, { lockRotation : Boolean }: Object) Parameters text − This parameter accepts a String which is the text string that we want to display inside our textbox. ...
Read MoreHow to add stroke to IText using FabricJS?
In this tutorial, we are going to learn how to add stroke to IText using FabricJS. The IText class was introduced in FabricJS version 1.4, extends fabric.Text and is used to create IText instances. An IText instance gives us the freedom to select, cut, paste or add new text without additional configurations. There are also various supported key combinations and mouse/touch combinations which make text interactive which are not provided in Text. Textbox, however, which is based on IText allows us to resize the text rectangle and wraps lines automatically. This is not true for IText as height is ...
Read More