Horje
javascript find all matches in array Code Example
javascript find all matches in array
const arr = [
  {
    name: 'string 1',
    arrayWithvalue: '1,2',
    other: 'that',
  },
  {
    name: 'string 2',
    arrayWithvalue: '2',
    other: 'that',
  },
  {
    name: 'string 2',
    arrayWithvalue: '2,3',
    other: 'that',
  },
  {
    name: 'string 2',
    arrayWithvalue: '4,5',
    other: 'that',
  },
  {
    name: 'string 2',
    arrayWithvalue: '4',
    other: 'that',
  },
];

const items = arr.filter(item => item.arrayWithvalue.indexOf('4') !== -1);

console.log(items);




Javascript

Related
if statement inside a function in javascript Code Example if statement inside a function in javascript Code Example
Cursor.jsx:8 Uncaught TypeError: Cannot read properties of null (reading 'clientWidth') Code Example Cursor.jsx:8 Uncaught TypeError: Cannot read properties of null (reading 'clientWidth') Code Example
vuejs props declare prop with multiple types Code Example vuejs props declare prop with multiple types Code Example
condition inner populate mongoose Code Example condition inner populate mongoose Code Example
react toastify dark mode Code Example react toastify dark mode Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
6