Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

obj[key].includes is not a function

// Try using Object.values instead:

var aa = [{id: 1,type: 1,status: 1,name: 'txt'},{id: 2,type: 1,status: 1,name: 'txt'},{id: 3,type: 0,status: 0,name: 'txt'}];

function filterIt(arr, searchKey) {
  return arr.filter(function(obj) {
    return Object.values(obj).includes(searchKey);
  });
}

console.log(filterIt(aa, 'txt'));
Comment

PREVIOUS NEXT
Code Example
Javascript :: strart a nextjs project 
Javascript :: javascript upload json 
Javascript :: react input number 
Javascript :: socket io broadcast to room 
Javascript :: or in js 
Javascript :: typing refs react 
Javascript :: format number to 2 digits javascript 
Javascript :: downgrade react version to 17 
Javascript :: javascript read xlsx file 
Javascript :: javascript get child by name 
Javascript :: styled of styled component not working in nextjs 
Javascript :: node js sublime text 
Javascript :: javascript random alphabet 
Javascript :: react native build apk 
Javascript :: sending form data with fetch using js 
Javascript :: how to capitalize string in javascript 
Javascript :: javascript get text from paragraph 
Javascript :: find the last row of table jquery 
Javascript :: jquery change value 
Javascript :: get value of span jquery 
Javascript :: javascript fetch post form data 
Javascript :: how to make a bot react to own message js 
Javascript :: javascript local storage delete 
Javascript :: clear location state react 
Javascript :: react useeffect not on first render 
Javascript :: regex min length max length 
Javascript :: check if function exists javascript 
Javascript :: select 2nd td jquery 
Javascript :: check if url contains string 
Javascript :: javsacript split string at position 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =