JavaScript Question

Ray Rolls

Regular Member
Joined
Dec 5, 2011
Messages
464
Reaction score
196
Any JavaScript masters out here can help me understand this

If I have a couple of objects in an array and I need to check if one of their properties have the same boolean value. How the hell would I pull that off?

Example:
const someArray = [{
title: "blah blah",
is_read: true
}, {
title: "yadda yadda",
is_read: true
}];

I thought I could use every() to check if is_read would be true but I'm not getting the desired result so I'm obviously doing something wrong.

Any help is appreciated as this is strictly for learning purposes.
 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes#Browser_compatibility
 
Thank you. Just what the dr ordered.
 
To check if true:

if( is_read ) { //TRUE }

To check if false:

if( !is_read ) { //FALSE }
 
Back
Top