skip to Main Content

filter of Filter in javascript array

I have an array that I'm trying to filter: const elements = ['apple']; const objects = [ { id: 1, fruit:[{"name": "apple" },{"name": "banana" }]}, { id: 2, fruit:[{"name": "apple" },{"name": "orange" }]}, { id: 3, fruit:[{"name": "orange" },{"name": "banana"…

VIEW QUESTION

Javascript – How to detect whether each element of a list of element-nodes does feature a specific css-class name?

Given the following test environment ... const nodeList = document.querySelectorAll('p'); const testArray = Array.from(nodeList); testArray.every(function (elmNode) { if (elmNode.classList.contains('ipsum')) { console.log( 'All element nodes do feature the `ipsum` css-class name.' ); } }); .lorem { font-family: courier new, courier; }…

VIEW QUESTION
Back To Top
Search