Javascript Articles - Page 578 of 671

How [ ] is converted to Number in JavaScript?

Lakshmi Srinivas
Updated on 23-May-2020 09:15:26

210 Views

Use the Number() method in JavaScript to convert to Number. You can try to run the following code to learn how to convert [ ] to Number in JavaScript.ExampleLive Demo           Convert [] to Number                var myVal = [];          document.write("Number: " + Number(myVal));          

Which event occurs in JavaScript when an element's content is pasted?

Vrundesha Joshi
Updated on 23-May-2020 09:14:49

139 Views

The onpaste event occurs when you paste content in the element.ExampleYou can try to run the following code to learn how to work with onpaste event in JavaScript.                          function pasteFunction() {             document.write("Text pasted successfully!");          }          

What is the role of altKey Mouse Event in JavaScript?

Sravani S
Updated on 23-May-2020 09:13:53

228 Views

The altkey mouse event property is used to show whether SHIFT key is pressed or not when mouse button is clicked.ExampleYou can try to run the following code to learn how to implement altKey Mouse event in JavaScript.           Press and hold ALT key and then click here.                function funcAltKey(event) {             if (event.altKey) {                alert("ALT key: Pressed");             } else {                alert("ALT key: NOT Pressed");             }          }          

How null is converted to Boolean in JavaScript?

Saurabh Jaiswal
Updated on 11-Aug-2022 12:28:54

7K+ Views

In JavaScript null is a predefined keyword that represents an empty value or unknown value of no value. The data type of null is an object. In this article, we will learn how to convert null into Boolean using multiple approaches which are following. Using the Boolean function Using the !! operator Using the Boolean function The Boolean function is used to get the Boolean value (true or false) of any variable, condition, or object. To convert the null into Boolean we just need to pass the null in the Boolean function. Syntax Boolean(null) Example 1 In this example, ... Read More

How to set the inward offsets of the image border with JavaScript?

Shubham Vora
Updated on 15-Nov-2022 08:02:29

245 Views

In this tutorial, we will learn how to set the inward offsets of the image border with JavaScript. An image can be set in the border as a border image using CSS properties. The border image can be set using different parameters. To set the inward offsets of the image border, use the borderImageSlice property in JavaScript. We will see two different approaches to setting up the inward offsets of the image border with JavaScript − The borderImageSlice Property The setProperty Method Using the borderImageSlice Property The border image’s inward offsets are specified by the borderImageSlice property of ... Read More

Which event occurs in JavaScript when an element is content is copied to clipboard?

Nitya Raut
Updated on 23-May-2020 09:12:11

137 Views

When a user copies the element’s content, then the oncopy event triggers.ExampleYou can try to run the following code to learn how to implement oncopy event in JavaScript.                          function copyFunction() {             document.write("Text copied!");          }          

Which event occurs in JavaScript when an element's content is cut?

V Jyothi
Updated on 23-Jun-2020 09:11:38

151 Views

The oncut event occurs when an element’s content is cut. You can try to run the following code to learn how to work with an oncut event in JavaScript −Example                          function cutFunction() {             document.write("Text cut!");          }          

How null is converted to String in JavaScript?

Saurabh Jaiswal
Updated on 11-Aug-2022 12:47:31

21K+ Views

In JavaScript null is a predefined keyword that represents an empty value or unknown value of no value. The data type of null is an object. In this article, we will learn how to convert null into String using multiple approaches which are following. Using the String() Method Concatenating null with an Empty string Using the Logical OR (||) Using Ternary Operator Using the String() Method The String() in JavaScript is used to convert a value to a String. To convert the null into a String just pass the null into this method. Here is the example ... Read More

How to return the position of the element relative to floating objects in JavaScript?

Prabhdeep Singh
Updated on 07-Nov-2022 07:32:28

484 Views

This tutorial teaches us how to return the position of the element relative to floating objects in JavaScript. To set the relative position or to get or return the relative position we are going to use the ‘clear’ property of JavaScript which is defined under the style property of an object. There are a total of four relative positions that are ‘left’, ‘right’, ‘top’, and ‘bottom’, and if we relatively position an object then it will fill all the gaps of that particular side. The float property of the JavaScript language can be used to set the property of the ... Read More

Which event occurs in JavaScript when an element is dragged completely?

Ayyan
Updated on 22-May-2020 11:30:29

109 Views

The ondragend event triggers when an element is dragged completely.ExampleYou can try to run the following code to learn how to implement ondragend event in JavaScript.                    .drag {             float: left;             width: 100px;             height: 35px;             border: 2px dashed #876587;             margin: 15px;             padding: 10px;          }             ... Read More

Advertisements