I found some posts related but i cant make it work.
I have a variable:
var object = {id: "4", black: false, destacado: ""};
I need to make an if that makes something if "black" is true.
I found some posts related but i cant make it work.
I have a variable:
var object = {id: "4", black: false, destacado: ""};
I need to make an if that makes something if "black" is true.
Simply
if (object.black === true) {
// do your thing
}
Using ===
ensures that it is true
and not some other truthy value.