how to push mutual array elements in an array nested loop javascript
let array1 = ['element1', 'element2', 'element3', 'element4'];
let array2 = ['array2element', 'element2', 'element4'];
let mutualArrayElements = [];
for (let i = 0; i < array1.length; i++) {
for (let j = 0; j < array2.length; j++) {
if (array1[i] === array2[j]) {
mutualArrayElements.push(array1[i]);
}
}
};
// for nested loops
Also in JavaScript:
- remove elemtns from an array with splice
- javascript for group object properties based on another property
- javascript array pop
- react native gifted chat
- multiple image upload with preview and delete react js
- face-api.js
- website login and registartion source code jsp java
- flutter asset image not showing
- jquery to hide a div
- jquery close another dialog
- javascript check if object is null or empty
- Material-ui snowflake icon
- js escape url parameter
- math.floor js
- how to use componentdidmount in functional component
- crucer in js
- puppeteer block request javascript
- ScrollController not attached to any scroll views
- what is jsonwebtoken
- swagger editor
- printf statement in javascript
- javascript ceiling
- format currency javascript
- tolocalestring javascript currency fixing 2 decimal places