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
Checking a Checkbox with JavaScript
In JavaScript, you can programmatically check a checkbox by setting its checked property to true. This is useful for form validation, user interactions, or initializing form states. HTML Structure First, let's look at a basic checkbox structure: John David Using the checked Property The checked property is a boolean that determines whether a checkbox is selected. Set it to true to check the checkbox, or false to uncheck it. Checkbox Example ...
Read MoreLongest subarray which only contains strictly increasing numbers JavaScript
We are required to write a JavaScript function that takes in an array of numbers as the first and the only argument. The function should then return the length of the longest continuous subarray from the array that only contains elements in a strictly increasing order. A strictly increasing sequence is the one in which any succeeding element is greater than all its preceding elements. Example const arr = [5, 7, 8, 12, 4, 56, 6, 54, 89]; const findLongest = (arr) => { if(arr.length == 0) { ...
Read MoreFinding the smallest good base in JavaScript
For an integer num, we call k (k >= 2) a good base of num, if all digits of num base k are 1. For instance: 13 base 3 is 111, hence 3 is a good base for num = 13 Problem We are required to write a JavaScript function that takes in string str that represents a number as the only argument. The function should return the string representation of the smallest possible number which is a good base for str. For example, if the input to the function is: const str = ...
Read MoreHow to build a random quote generator using HTML, CSS, and JavaScript?
In this tutorial, we'll build a random quote generator using HTML, CSS, and JavaScript. The application fetches quotes from an API and displays them in an elegant interface with a button to generate new quotes. Project Overview Our quote generator will include: Clean HTML structure with quote display area Responsive CSS styling with hover effects JavaScript logic to fetch quotes from type.fit API Random quote selection and display functionality HTML Structure First, let's create the HTML template ...
Read MoreHow to check if an Image has crop applied using FabricJS?
In this tutorial, we are going to show how you can check if an Image has crop applied using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to find whether an Image has crop applied, we use the hasCrop method. This method returns false in case of crop is not applied, or the applied crop value in case if it is applied. Syntax hasCrop(): Boolean | Number ...
Read MoreAdding a pattern with image and colour to a Polygon using FabricJS
We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to add pattern with image and colour to a Polygon, we can use the Pattern class in FabricJS. Syntax new fabric.Pattern( options: Object, callback: function ) Parameters ...
Read MoreHow to highlight an object when a mouse is hovered over it using FabricJS?
We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. FabricJS provides us with an extensive set of events with which we can create different effects. Since we want the change to occur when the mouse is hovered, we will use the mouse:move event which is fired when the mouse is moved. Our second requirement ...
Read MoreCan JavaScript be used for Android Development?
JavaScript has become a powerful option for Android app development through hybrid frameworks and cross-platform solutions. While not traditionally used for native Android development, JavaScript enables developers to create mobile applications that run on Android devices using web technologies. Modern JavaScript frameworks like React Native, Ionic, and Cordova allow developers to build Android apps using familiar web development skills. This approach combines the accessibility of JavaScript with the functionality of mobile applications. How JavaScript Works for Android Development JavaScript can be used for Android development through several approaches: Hybrid Apps: Web applications ...
Read MoreHow to choose a background color through a color picker in JavaScript?
While working with HTML and CSS to create a web page, we require to choose a color from the color picker. Also, sometimes we may require to select the background color through the color picker input. In this tutorial, we will learn different approaches which allow users to choose a background color from the color-picker input, and when the user selects a new color, it should change the background color. Using the Color Picker with Button Click In HTML, color picker input allows users to choose a color from that. We can get a selected color value ...
Read MoreDifference between two times using Dayjs JavaScript library?
Day.js is a lightweight JavaScript library for date manipulation. The diff() method calculates the difference between two time instances and returns the result in the specified unit. Syntax dayjs().diff(date, unit) Parameters date - The date to compare with unit - The unit of measurement: 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years' Example: Basic Time Difference Day.js Time Difference ...
Read More