filtering json array in javascript
JavaScript
const data = [
{
name: 'Bob',
gender: 'male',
age: 34,
},
{
name: 'Carol',
gender: 'female',
age: 36,
},
{
name: 'Ted',
gender: 'male',
age: 38,
},
{
name: 'Alice',
gender: 'female',
age: 40,
},
];
const arr1 = data.filter(d => d.age > 37);
console.log('arr1', arr1);
const arr2 = data.filter(d => d.gender === 'female');
console.log('arr2', arr2);
const ageAndGender = d => d.age > 37 && d.gender === 'female';
const arr3 = data.filter(ageAndGender);
console.log('arr3', arr3);
Also in JavaScript:
- Title
- get current directory vbscript
- Category
- JavaScript
- Title
- dynamic for loop react
- Category
- JavaScript
- Title
- date object javascript
- Category
- JavaScript
- Title
- how to get element by title js
- Category
- JavaScript
- Title
- how to get value in array object value using for loop in javascript
- Category
- JavaScript
- Title
- How to check whether a string contains a substring in JavaScript?
- Category
- JavaScript
- Title
- how to create seeds in sequelise
- Category
- JavaScript
- Title
- how to make a property important in javascript
- Category
- JavaScript
- Title
- graphql react filtering
- Category
- JavaScript
- Title
- bootstrap modal remove gray background
- Category
- JavaScript
- Title
- import json file javascript
- Category
- JavaScript
- Title
- document ready javacsript
- Category
- JavaScript
- Title
- eyeshot javascript version
- Category
- JavaScript
- Title
- express server replit
- Category
- JavaScript
- Title
- get day js
- Category
- JavaScript
- Title
- box shadow javascript style change
- Category
- JavaScript
- Title
- get selected option value
- Category
- JavaScript
- Title
- array.filter in js
- Category
- JavaScript
- Title
- empty a select input using js
- Category
- JavaScript
- Title
- append to array js
- Category
- JavaScript
- Title
- javascript 1 + "1"
- Category
- JavaScript
- Title
- how to add property to object in javascript
- Category
- JavaScript
- Title
- console trace js
- Category
- JavaScript
- Title
- Data Change with Mutation
- Category
- JavaScript
- Title
- how to generate random character from an array js
- Category
- JavaScript
- Title
- how to add object to list in javascript
- Category
- JavaScript
- Title
- how run dockerfile
- Category
- JavaScript
- Title
- install node modules
- Category
- JavaScript
- Title
- can we import jquery library from developer tools
- Category
- JavaScript
- Title
- javascript access php variable
- Category
- JavaScript
- Title
- integers to space separated string in javascript
- Category
- JavaScript
- Title
- how to add elements in javascript html
- Category
- JavaScript
- Title
- adding element to array javascript
- Category
- JavaScript
- Title
- array methods in javascript
- Category
- JavaScript
- Title
- add item to array javascript
- Category
- JavaScript
- Title
- function to create an element javascript
- Category
- JavaScript
- Title
- debug node
- Category
- JavaScript
- Title
- background-image url not working
- Category
- JavaScript
- Title
- how to include local image files in javascript object
- Category
- JavaScript
- Title
- express get query params from url
- Category
- JavaScript
- Title
- for of and for in javascript
- Category
- JavaScript
- Title
- facebook integration in node.js
- Category
- JavaScript
- Title
- array length for boolean in javascript
- Category
- JavaScript
- Title
- convert military time to standard time javascript
- Category
- JavaScript
- Title
- how to send enter event to input field jquery
- Category
- JavaScript
- Title
- clear cookies js
- Category
- JavaScript
- Title
- Basic JavaScript: Use Recursion to Create a Range of Numbers
- Category
- JavaScript
- Title
- bootstrap datepicker js cdn
- Category
- JavaScript
- Title
- Angular empty object
- Category
- JavaScript
- Title
- faunadb ref
- Category
- JavaScript
- Title
- create react app scaffolding
- Category
- JavaScript
- Title
- anjular js
- Category
- JavaScript
- Title
- html table to excel javascript
- Category
- JavaScript
- Title
- ajax laravel example
- Category
- JavaScript
- Title
- javascript append element to array
- Category
- JavaScript
- Title
- export component in
- Category
- JavaScript
- Title
- click on a radio button using jquery
- Category
- JavaScript
- Title
- clear input field value javascript
- Category
- JavaScript
- Title
- closures javascript
- Category
- JavaScript
- Title
- inline style boarder radius jsx
- Category
- JavaScript
- Title
- array remove first element javascript
- Category
- JavaScript
- Title
- * http://sizzlejs.com/
- Category
- JavaScript
- Title
- datetime to date javascript
- Category
- JavaScript
- Title
- get the size of the browser jquery
- Category
- JavaScript
- Title
- change dxform label angular
- Category
- JavaScript
- Title
- fix a navbar to top of page js
- Category
- JavaScript
- Title
- axios js and react
- Category
- JavaScript
- Title
- how to add onclick to child element created javascript
- Category
- JavaScript
- Title
- checking object is empty in JS
- Category
- JavaScript
- Title
- get text of selected option jquery
- Category
- JavaScript
- Title
- jalali moment get milisocnds
- Category
- JavaScript
- Title
- get start of day javascript
- Category
- JavaScript
- Title
- adding mui theme to index.js
- Category
- JavaScript
- Title
- get a element using name in jquery
- Category
- JavaScript
- Title
- how to import npm packages in node.js?
- Category
- JavaScript
- Title
- javascript anagram check
- Category
- JavaScript
- Title
- iterate over array javascript
- Category
- JavaScript
- Title
- HTML5 Accesskey Attribute: you may not need JavaScript to add Keyboard Shortcuts
- Category
- JavaScript
- Title
- dotenv jest
- Category
- JavaScript
- Title
- angular event scroll end of page
- Category
- JavaScript
- Title
- javascript check if objects are equal
- Category
- JavaScript
- Title
- how to log to the console javascript
- Category
- JavaScript
- Title
- how to get array values in javascript
- Category
- JavaScript
- Title
- how to play sound on load js
- Category
- JavaScript
- Title
- array shift javascript
- Category
- JavaScript
- Title
- grayscale image in canvas
- Category
- JavaScript
- Title
- forward and reverse loop one by one js
- Category
- JavaScript
- Title
- get parent element using jquery
- Category
- JavaScript
- Title
- how to get a random element of an array javascript
- Category
- JavaScript
- Title
- how to create 3d gallery using javascript
- Category
- JavaScript
- Title
- javascript array elements search
- Category
- JavaScript
- Title
- angular $http abort request
- Category
- JavaScript
- Title
- how to initialize an array in javascript
- Category
- JavaScript
- Title
- foreach javascript
- Category
- JavaScript
- Title
- get json data when we get error code in axios
- Category
- JavaScript
- Title
- append img to svg d3 js
- Category
- JavaScript
- Title
- javacript getHTTPURL
- Category
- JavaScript
- Title
- banking program deposit and withdrawal using ajax call
- Category
- JavaScript
- Title
- append array js
- Category
- JavaScript
- Title
- get month in two digit in javascript date
- Category
- JavaScript