Found 8895 Articles for Front End Technology

What is the difference between "strict" and "non-strict" modes of JavaScript?

Abhinanda Shri
Updated on 16-Jan-2020 10:27:46

850 Views

The “use strict” is a directive, which is a literal expression. It introduced in JavaScript 1.8.5. As the name suggests, “use strict” indicates that the code is to be executed in strict mode. Under non-strict, the code won’t execute won’t execute in strict mode.Let us declare strict mode. To declare, add the keyword “use strict” in the beginning. For global scope, declare it at the beginning of the script.           An error would come, since you have used a variable, but forgot to declare it       Press F8 to see the error.                "use strict";          a = 1;          

How to invoke a JavaScript Function with 'new' Function Constructor?

Shubham Vora
Updated on 14-Sep-2022 13:55:26

601 Views

In this tutorial, we will learn how to invoke a JavaScript Function with the 'new' Function Constructor. Functions are a set of reusable codes that perform a specific task and may return a value. In JavaScript, functions are defined by the keyword function. A function may not have any parameters and may also not have any return statement. In JavaScript, we also have functions with no function names, called anonymous functions Using the 'new' Function Constructor The Function constructor makes a new Function object. By using the constructor, we can create a function dynamically. It takes parameters, or arguments, and ... Read More

How to call a function in JavaScript?

Nancy Den
Updated on 19-Jun-2020 11:24:12

867 Views

JavaScript allows us to write our own functions as well. To invoke a function somewhere later in the script, you would simply need to write the name of that function.ExampleYou can try to run the following code to learn how to call a function in JavaScript −                    function sayHello() {             document.write ("Hello there!");          }                     Click the following button to call the function                             Use different text in write method and then try...    

How to call a JavaScript function on click?

Govinda Sai
Updated on 19-Jun-2020 11:23:44

1K+ Views

To call a function on click of a button in JavaScript, use onclick. Try to run the following code to call a function onclick in JavaScript −Example                    function sayHello() {             document.write ("Hello there!");          }                     Click the following button to call the function                             Use different text in write method and then try...    

What are Complex Data types in JavaScript?

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

2K+ 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

2K+ 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

135 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 onkeyup event in JavaScript?

vanithasree
Updated on 19-Jun-2020 11:18:47

307 Views

The onkeyup event triggers when a key is released.ExampleYou can try to run the following code to learn how to work with onkeyup event in JavaScript −                                         Enter subject below in upper case and see what happpens.          

What is onsubmit event in JavaScript?

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

3K+ 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

260 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                                            

Advertisements