- 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 10878 Articles for Web Development
147 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
391 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
62K+ 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
510 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
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
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
14K+ 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
2K+ 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
827 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;