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 by Shubham Vora
Page 29 of 80
How to set whether or not an element is resizable by the user with JavaScript?
In this tutorial, we will learn to set whether or not an element is resizable by the user with JavaScript. The CSS resize property controls if users can drag element corners to change its size. Web elements are typically fixed in position and size. However, sometimes you need to allow users to resize elements dynamically. The CSS resize property provides this functionality, and JavaScript's DOM manipulation allows us to control this behavior programmatically. Using the Style resize Property The resize property determines whether an element can be resized by the user. Common examples include textarea elements, which ...
Read MoreFor the Hosts Locale how to convert a string to uppercase letters in JavaScript?
In this tutorial, we will learn how to convert a string to uppercase letters for the host's locale in JavaScript. While using a locale language to write for a website, we might have to convert the sentence from lowercase to uppercase without changing the structure of the string. Using the toLocaleUpperCase() Method In JavaScript, we use the toUpperCase() method as well as the toLocaleUpperCase() to change the letters of a string to uppercase. Although both methods give similar output, the toLocaleUpperCase() is used primarily for local languages and handles locale-specific character mappings correctly. Syntax We ...
Read MoreHow to set the type of quotation marks for embedded quotations with JavaScript?
In this tutorial, we will learn how to set the type of quotation marks for embedded quotations with JavaScript. The types of quotation marks can be changed using JavaScript. For example, if a sentence is in double quotes(""), it can be modified to single quotes(''). To set the quotation, use the element. With that, add the type of quotation marks with the quotes property. Using the quotes property to set the type of quotation marks In JavaScript, the quotes property is used to set the type of quotation marks for embedded quotations. The quotation marks can ...
Read MoreHow does JavaScript 'return' statement work?
In this article, we will learn how to work with a return statement in JavaScript. A specific value from the function is returned to the function caller using the return statement. Whenever the return statement is run, the function will stop. The code that follows the return statement won't be available, due to which it is the last statement in a function. Using the return statement, we may return object types, including functions, objects, arrays, and primitive values like Boolean, integer, and string. By using the return statement, we can also return many items. To return several values ...
Read MoreHow to set the color of the right border with JavaScript?
In this tutorial, we will learn how to set the color of the right border with JavaScript. To set the color of the right border in JavaScript, use the borderRightColor property. Set the color of the right border using this property. We can also apply the borderColor property to complete the task. The border is the outline of an HTML element. Border color can be set for different sides using different properties. To set the color of the right border with JavaScript, we have different ways − Using the style.borderRightColor Property ...
Read MoreHow to check if a variable is boolean in JavaScript?
In JavaScript, determining if a variable is a boolean can be tricky because of type coercion. When using the equality operator (==), JavaScript converts values, so true == "true" returns true even though they're different types. To accurately check boolean types, we need specific methods. Here are three reliable approaches to check if a variable is a boolean: Using the typeof operator Using the strict equality operator (===) Using Object.prototype.toString.call() Using the typeof Operator The typeof operator returns a string indicating the ...
Read MoreHow to set the top position of an element with JavaScript?
In this tutorial, we shall learn to set the top position of an element with JavaScript. To set the top position of an element, we can use the DOM Style top property in JavaScript. Alternatively, we can use the DOM Style setProperty() method. Let us discuss our topic in brief. Using the Style top Property We can set or return the top position of an element using the JavaScript DOM style top property. Following is the syntax to set the top position of an element using the Style top property with the dot notation or square brackets. ...
Read MoreHow to initialize a boolean array in JavaScript?
In JavaScript, boolean arrays are useful for storing true/false values. You can initialize them using several methods, each with different advantages depending on your needs. We can initialize a boolean array in JavaScript in three ways: Using the fill() Method Using the Array.from() Method Using the for Loop Using the fill() Method The fill() method is the simplest way to create a boolean array with all elements having the same value. It fills all array positions with a static value from start to end. ...
Read MoreHow to set the width of the top border with JavaScript?
In this tutorial, we will learn how to set the width of the top border with JavaScript. The border of an element is the outer part of the element. The border width for each side can be set with different JavaScript properties. For example, to set the width of the top border in JavaScript, use the borderTopWidth property. There are two approaches to specifying the width of the top border − Using the setProperty method Using the borderTopWidth property Using the setProperty Method In JavaScript, any property ...
Read MoreHow to perform integer division and get the remainder in JavaScript?
In JavaScript, performing integer division and getting the remainder requires different operators than regular division. The division operator (/) returns a floating-point result, while the remainder operator (%) gives you what's left after division. The remainder operator (%) returns the remainder when one operand is divided by another. It always takes the sign of the dividend (the first operand). For the operation x % y, x is the dividend and y is the divisor. Understanding Division vs Remainder Regular division in JavaScript returns decimal results, but for integer division, we need to use Math.floor() or other methods ...
Read More