javascript
Util Array Examples
const allLanguages = [ 'ES', 'EN', 'DE' ]
const usedLanguages = [ { id: 1, lang: 'EN' } ].map(e => e.lang);
var result = allLanguages.filter(e => !usedLanguages.includes(e));
console.log(result)
=================
const myArrayFiltered = this.AllGroupActive.filter(array => this.workFrontAnomalyType.developmentStageGroupId.some(filter => filter === array.id ));
const checkAllActive = myArrayFiltered.every(item => item.active);
===========================================================
var arr1 = ['a', 'b'];
var arr2 = ['a', 'b', 'c', 'd'];
let intersection = arr1.filter(x => arr2.includes(x));
let difference = arr1.filter(x => !arr2.includes(x));
symmetric difference,
let difference = arr1
.filter(x => !arr2.includes(x))
.concat(arr2.filter(x => !arr1.includes(x)));
=======================
someValues.forEach((element, index) => {
console.log(`Current index: ${index}`);
console.log(element);
});
============
removeAnomaly(anomaly: WorkFrontAnomaly){
var index = this.workFrontAnomalies.indexOf(anomaly);
if(index != -1){
this.workFrontAnomalies.splice(index, 1);
}
}
Was this helpful?
Similar Posts
- Javascript examples to remove url from a string
- While loop in Javascript with examples
- Sort array using Array.sort() in javascript
- Break an array into fixed length array groups using lodash in Javascript
- Get all values from an array which does not exist in other array Lodash
- Convert a string to array using Array.from() in javascript
- Collect books from array of objects and return collection of books as an array