
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
Found 6710 Articles for Javascript

12K+ Views
In this tutorial, we will learn different ways of finding the maximum and minimum elements of an array in JavaScript. The minimum element is the smallest element among all the elements present in the array, while the maximum is the largest among them Below are the approaches we can use to find the min/max elements of an array. Traverse the whole Array Using the Math.min() and Math.max() Methods. Let us discuss these approaches with help of program examples. Approach 1: Traverse the whole Array In this approach, we will traverse the whole array using the for loop and ... Read More

1K+ Views
In this article, we will learn how to work with a return statement in JavaScript. A specific value from the function is returned to the function caller using the return statement. Whenever the return statement is run, the function will stop. The code that follows the return statement won't be available, due to which it is the last statement in a function.Using the return statement, we may return object types, including functions, objects, arrays, and primitive values like Boolean, integer, and string.By using the return statement, we can also return many items. Immediate action is not viable. To return several ... Read More

17K+ Views
To return a string from a JavaScript function, use the return statement in JavaScript.ExampleYou need to run the following code to learn how to return a string using return statement − function concatenate(name, subject) { var val; val = name + subject; return val; } function DisplayFunction() { var result; result = concatenate('Amit', ' Java'); document.write (result ); } Click the following button to call the function

3K+ Views
To return a value from a JavaScript function, use the return statement in JavaScript. You need to run the following code to learn how to return a value −Example function concatenate(name, age) { var val; val = name + age; return val; } function DisplayFunction() { var result; result = concatenate('John ', 20) ; document.write (result ); } Click the following button to call the function

935 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;

779 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

1K+ 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...

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

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