Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Javascript Articles - Page 577 of 671
145 Views
Use the Number() method in JavaScript to convert to Number. You can try to run the following code to learn how to convert [50, 100] to Number in JavaScript − Example Live Demo Convert [50,100] to Number var myVal = [50,100]; document.write("Number: " + Number(myVal));
133 Views
When a mouse event is triggered, the pageY mouse event property is used to get the vertical coordinate of the mouse pointer. The coordinate is relative to the screen.ExampleYou can try to run the following code to learn how to implement pageY Mouse event in JavaScript. Click here to get the x (horizontal) and y (vertical) coordinates of the mouse pointer. function coordsFunc(event) { var x_coord = event.pageX; var y_coord = event.pageY; var xycoords = "X coords= " + x_coord + ", Y coords= " + y_coord; document.write(xycoords); }
369 Views
When a mouse event is triggered, the pageX mouse event property is used to get the horizontal coordinate of the mouse pointer. The coordinate is relative to the screen.ExampleYou can try to run the following code to learn how to implement pageX Mouse event in JavaScript. Click here to get the x (horizontal) and y (vertical) coordinates of the mouse pointer. function coordsFunc(event) { var x_coord = event.pageX; var y_coord = event.pageY; var xycoords = "X coords= " + x_coord + ", Y coords= " + y_coord; document.write(xycoords); }
244 Views
The ctrlkey mouse event property is used to show whether the CTRL key is pressed or not when the mouse button is clicked.ExampleYou can try to run the following code to learn how to implement ctrlKey Mouse event in JavaScript. Press and hold CTRL key and then click here. function funcCtrlKey(event) { if (event.ctrlKey) { alert("CTRL key: Pressed"); } else { alert("CTRL key: NOT Pressed"); } }
230 Views
Use the Number() method in JavaScript to convert to Number. You can try to run the following code to learn how to convert -Infinity Number in JavaScript.ExampleLive Demo Convert -Infinity to Number var myVal = -Infinity; document.write("Number : " + Number(myVal)); OutputConvert -Infinity to Number Number : -Infinity
171 Views
When a mouse event is triggered, the clientY mouse event property is used to get the vertical coordinate of the mouse pointer. This is according to the current window.ExampleYou can try to run the following code to learn how to implement clientY Mouse event in JavaScript. Click here to get the x (horizontal) and y (vertical) coordinates (according to current window) of the mouse pointer. function coordsFunc(event) { var x_coord = event.clientX; var y_coord = event.clientY; var xycoords = "X coords= " + x_coord + ", Y coords = " + y_coord; document.write(xycoords); }
397 Views
When a mouse event is triggered, the clientX mouse event property is used to get the horizontal coordinate of the mouse pointer. This is according to current window.ExampleYou can try to run the following code to learn how to implement clientX Mouse event in JavaScript. Click here to get the x (horizontal) and y (vertical) coordinates (according to current window) of the mouse pointer. function coordsFunc(event) { var x_coord = event.clientX; var y_coord = event.clientY; var xycoords = "X coords= " + x_coord + ", Y coords= " + y_coord; document.write(xycoords); }
916 Views
To set the color of the bottom border in JavaScript, use the borderBottomColor property. It allows you to set the border color for the bottom of a border.ExampleYou can try to run the following code to learn how to set the color of the bottom border −Live Demo #box { border: 2px dashed blue; width: 120px; height: 120px; } Set border bottom color Demo Text Demo Text function display() { document.getElementById("box").style.borderBottomColor = "yellow"; }
2K+ Views
In this article, we will learn how to convert NaN to Boolean. NaN in JavaScript means Not a Number, whose type is a Number but actually, it is not a number. To Convert, the NaN to a Boolean we use Multiple methods some of which are discussed below. Using the Boolean() Function Using the !! Operator Using the NOT Operator and isNaN() Method 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 NaN into Boolean we just need to pass the ... Read More
2K+ Views
A simple wrapper object is the number. Numerous methods and constants are available when using the Number function Object() { [native code] }. The Number() method may be used to transform values of different kinds into numbers. The IEEE 754 double-precision 64-bit binary value type is used in JavaScript. This indicates that it can represent fractional values, but the amount of data it can hold is constrained. Arithmetic is vulnerable to rounding, and a number only retains roughly 17 decimal places of precision. A Number may carry a maximum value of around 1.8E308. Higher values are substituted with the ... Read More