Answers for "array has object with property js"

0

array has object with property js

myArray.some(obj => obj.property === 'value')
// returns true or false
Posted by: Guest on March-05-2021
0

javascript include property array object

const data = [{ name: 'dendi', age: 23 }, { name: 'dhani' }]
const result = data.filter((v, i) => {
	if (!Object.keys(v).includes('age')) {
		Object.defineProperty(v, 'age', {
			value: 25,
			writeable: true,
			enumerable: true
		})
	}
	return v
})
Posted by: Guest on July-23-2021

Code answers related to "array has object with property js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language