Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

array contains multiple js

var containsAll = arr1.every(i => arr2.includes(i));
Comment

js array includes multiple items

function inArray(needle, haystack, matchAll = false) {
    if (matchAll) {
        return needle.every(i => haystack.includes(i));
    } else {
        return needle.some(i => haystack.includes(i));
    }
}

let result = inArray(needle, haystack, true);
Comment

PREVIOUS NEXT
Code Example
Javascript :: beautify json in html 
Javascript :: repeat string n times javascript 
Javascript :: flatten in js without lodash 
Javascript :: datatable hide columns 
Javascript :: convertir seconde 
Javascript :: mongodb add admin user 
Javascript :: javascript window.history.pushstate 
Javascript :: js get current function name 
Javascript :: update angular materia; 
Javascript :: roblox headshot image 
Javascript :: How to install react native hooks with npm 
Javascript :: xhr 
Javascript :: wait for element to load 
Javascript :: node es6 import 
Javascript :: object values javascript 
Javascript :: jspdf add page 
Javascript :: discord js fetch user 
Javascript :: assign an element value as key in array of objects 
Javascript :: Finding HTML Element by Id 
Javascript :: sass config.json vs code 
Javascript :: javascript current date time 
Javascript :: jquery validate checkbox before submit 
Javascript :: jquery select div in div 
Javascript :: jquery array 
Javascript :: hardhat test 
Javascript :: javascript find all occurrences in string 
Javascript :: how to modify external json file javascript 
Javascript :: change value of drop down using jquery 
Javascript :: jquery get request with headers 
Javascript :: js localstorage 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =