Javascript Articles - Page 575 of 671

What is the role of parseInt() method in JavaScript?

Smita Kapse
Updated on 23-May-2020 11:04:04

256 Views

Use the parseInt() method in JavaScript to return an integer after parsing a string. You can also set the numeral system as a second parameter.ExampleYou can try to run the following code to learn how to work with parseFloat() method in JavaScript.                    var val1 = parseInt("20.50");          var val2 = parseInt("30 minutes");          var val3 = parseInt("20",16);                    document.write(val1);          document.write(""+val2);          document.write(""+val3);          

What is the role of parseFloat() method in JavaScript?

Priya Pallavi
Updated on 23-May-2020 11:04:59

194 Views

Use the parseFloat() method in JavaScript to return a floating point number after parsing a string.ExampleYou can try to run the following code to learn how to work with parseFloat() method in JavaScript.                    var val1 = parseFloat("2");          var val2 = parseFloat("30 minutes");          document.write(val1);          document.write(""+val2);          

What will happen when [50,100] is converted to Boolean in JavaScript?

Sharon Christine
Updated on 23-May-2020 11:02:51

114 Views

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

How to set the width of the right border with JavaScript?

Shubham Vora
Updated on 12-Oct-2022 11:13:56

291 Views

This tutorial will teach us to set the width of the right border with JavaScript. To set the width of the right border, use the borderRightWidth property. Set the width of the right border using this property. We can also apply the borderWidth to set the right border. Borders are used on various elements on a webpage. They display the boundaries of an element. We can apply the borders to all sides of an element. There are different properties to set different sides of a border. For a static border, generally, CSS is used. But to change it dynamically, JavaScript ... Read More

How to set the style of the right border with JavaScript?

Shubham Vora
Updated on 12-Oct-2022 10:55:35

255 Views

In this tutorial, we will learn to set a style of the right border with JavaScript. To set the style of the right border in JavaScript, use the borderRightStyle property. Set the style of the right border using this property. We can apply borders to an element from any side or all sides. We can customize that border on any side. Every edge of a border has a specific property that can use only for that edge. We can provide three parameters like style, color, and width for creating a border. CSS is used to do such tasks. But, we ... Read More

What is the usage of copyWithin() method in JavaScript?

Nikitha N
Updated on 23-May-2020 11:00:01

186 Views

Use the copyWithin() method in JavaScript to copy array elements. You can set the index from/to where (index) the elements are copied. The following are the elements supported by JavaScript.target − The position of the index from where the elements is to be copied.begin − The index to start copying the element. This is an optional parameter.end − The index to end copying the element. This is an optional parameter.ExampleYou can try to run the following code to learn how to work with copyWithin() method in JavaScript.                    var num ... Read More

What is the role of Keyboard Event altKey Property in JavaScript?

Daniol Thomas
Updated on 23-May-2020 11:00:45

165 Views

The altkey property is used to show whether ALT key is pressed or not when key event was triggered.ExampleYou can try to run the following code to learn how to implement altKey property in JavaScript.                 Press any key                function funcAltKey(event) {             var val = document.getElementById("res");                         if (event.altKey) {                val.innerHTML = "ALT key: Pressed";             } else {                val.innerHTML = "ALT key: NOT Pressed";             }          }          

What will happen when { } is converted to String in JavaScript?

Arushi
Updated on 23-May-2020 10:16:37

145 Views

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

What is the usage of fill() method in JavaScript?

Abhinanda Shri
Updated on 02-Mar-2020 06:40:47

169 Views

The fill() method in JavaScript is used to fill elements with static value in an array. The following are the parameters for fill() −value− The value to be filled.begin− The start index to begin filling the array.end− The ending index to stop filling the array.ExampleYou can try to run the following code to learn how to work with fill() method on JavaScript −                    var num = ["One", "Two", "Three", "Four", "Five"];          document.write(num);          document.write(""+num.fill("Six",2,3));          

How [ ] is converted to Boolean in JavaScript?

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

169 Views

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

Advertisements