- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 8895 Articles for Front End Technology
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
170 Views
To declare optional function parameters in JavaScript, use the “default” arguments.ExampleYou can try to run the following code to declare optional parameters − // default is set to 1 function inc(val1, inc = 1) { return val1 + inc; } document.write(inc(10,10)); document.write(""); document.write(inc(10));
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
161 Views
In this tutorial, we will learn what "use strict" does in JavaScript. The "use strict" is a directive. JavaScript 1.8.5 is its origin. The use strict directive says that the JavaScript code must run in the strict mode. The strict directive is not a statement but rather a constant expression. Earlier JavaScript versions ignore this expression. We can't use undeclared variables when writing the code in strict mode. Except for IE9 and lower versions, all modern browsers support this JavaScript directive. Strict mode allows us to write a cleaner code as it throws errors when we use undeclared variables in ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
408 Views
In this tutorial, we will learn to remove an item from a JavaScript array by value. An array is a data structure that can store a collection of data with the same data type. A contiguous memory location is allocated to the array elements. Each array element is identified by its index value. You must process an array by inserting an element, removing or changing, etc. JavaScript has a lot of methods to update an array. Let us take a look at various ways to remove an item from a JavaScript array by value. Following are the Methods/Functions to remove ... Read More
![Abhishek](https://www.tutorialspoint.com/assets/profiles/545227/profile/60_599940-1667195518.jpeg)
66K+ Views
In this tutorial, we will discuss how we can find duplicate or repeating values in a JavaScript array using different methods or approaches to reach the solution to this problem. Below is the list of the approaches or methods we can use to solve the problem of finding duplicates − By simply Traversing the Array Using the filter() and indexOf() Methods Using the Set object and has() Method Let us discuss all of the above approaches to find duplicates in the JavaScript array − By Simply Traversing the Array Traversing the array using a nested for loop to ... Read More
![Nikitha N](https://www.tutorialspoint.com/assets/profiles/13558/profile/60_76068-1512713229.jpg)
540 Views
A two-dimensional array has more than one dimension, such as myarray[0][0] for element one, myarray[0][1] for element two, etc. To create a two-dimensional array in JavaScript, you can try to run the following code −ExampleLive Demo var myarray=new Array(3); for (i=0; i
![Abhishek](https://www.tutorialspoint.com/assets/profiles/545227/profile/60_599940-1667195518.jpeg)
10K+ 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
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
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
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
15K+ 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
![Srinivas Gorla](https://www.tutorialspoint.com/assets/profiles/13556/profile/60_78057-1512712331.jpg)
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