Javascript Articles - Page 489 of 534

What are Complex Data types in JavaScript?

Shubham Vora
Updated on 15-Nov-2022 10:46:59

3K+ Views

In this tutorial, we will learn complex data types in JavaScript. JavaScript has multiple built-in data types to store data in different formats. The data types of JavaScript can be divided into two groups, and those are primitive data types and non-primitive data types. Number, String, Boolean, Undefined and Null are part of the primitive data type, whereas the Array and Object are part of the non-primitive data type. The typeof operator is used to identify the data types. The primitive data types are simple and easy to use. In contrast, the non-primitive data types (Array and Object) are relatively ... Read More

How to create Empty Values String in JavaScript?

seetha
Updated on 19-Jun-2020 11:20:59

3K+ Views

To create empty values string in JavaScript, you can try to run the following code −Example                    var val;          val = "";          document.write("Value: "+val);          document.write("Type: "+typeof val);                  

Why JavaScript Data Types are Dynamic?

Sravani S
Updated on 16-Jan-2020 10:18:32

248 Views

JavaScript also has dynamic types. That would mean the same variable used for holding different data types in JavaScript.Example                    var val;          val = "Amit";          document.write("String: "+val);          val = 20;          document.write("Number: "+val);          val = 40.90;          document.write("Number with decimals: "+val);                  

What is onsubmit event in JavaScript?

V Jyothi
Updated on 19-Jun-2020 11:19:19

4K+ Views

The onsubmit event is an event that occurs when you try to submit a form. You can put your form validation against this event type. The following example shows how to use onsubmit. Here we are calling a validate() function before submitting a form data to the web server. If validate() function returns true, the form will be submitted, otherwise, it'll not submit the data.ExampleThe following example is a code snippet showing the usage of the onsubmit event −                                                  .......                    

What is onkeypress event in JavaScript?

radhakrishna
Updated on 19-Jun-2020 11:18:13

429 Views

The onkeypress event triggers when a key is pressed and released. You can try to run the following code to learn how to work with onkeypress event in JavaScript −Example                                            

What is onkeydown event in JavaScript?

Priya Pallavi
Updated on 19-Jun-2020 11:17:27

428 Views

The onkeydown event triggers when a key is pressed. You can try to run the following code to learn how to work with an onkeydown event in JavaScript −Example                                            

What is onmouseleave event in JavaScript?

Sreemaha
Updated on 19-Jun-2020 11:06:19

320 Views

The onmouseenter event triggers when after the mouse hover is moved out.ExampleYou can try to run the following code to learn how to work with an onmouseleave event in JavaScript −                                         This is demo text for mouseleave event.    

What is onmouseenter event in JavaScript?

Nishtha Thakur
Updated on 19-Jun-2020 11:06:58

350 Views

The onmouseenter event triggers when you mouse hover the pointer.ExampleYou can try to run the following code to learn how to work with onmouseenter event in JavaScript −                                         This is demo text for mouseenter event.    

What is oncontextmenu event in JavaScript?

usharani
Updated on 19-Jun-2020 11:03:46

508 Views

On right click of an element, when the context menu opens, then it is known as oncontextmenu in JavaScript.ExampleYou can try to run the following code to learn how to work with oncontextmenu event in JavaScript −                                         Right click    

How to add hours and minutes to a date with JavaScript?

Saurabh Jaiswal
Updated on 22-Aug-2022 08:06:32

12K+ Views

In this tutorial, we will learn how to add hours and minutes to a date with JavaScript. We have multiple methods to achieve this which are the following. Add hours using the setHours() Method. Add minutes using the setMinutes() Method. Add hours or minutes with the getTime() Method. Add hours using the setHours Method JavaScript date setHours() method sets the hours for a specified date according to local time. Syntax Following is the syntax to apply the setHours() method to add hours to date − Date.setHours(hours, minutes, seconds, ms) Note − Parameters except the first one are ... Read More

Advertisements