I have 3 questions about my code here...
- I am trying to understand what the
!
before thepassenders.paid
means? - And also, what other options do I have for putting operators before the logic?
- In this example, why are all my answers
true
when Sue has false?
var passengers = [{
name: "Jane Doloop",
paid: true
},
{
name: "Dr. Evel",
paid: true
},
{
name: "Sue Property",
paid: false
},
{
name: "John Funcall",
paid: true
},
];
for (var i = 0; i < passengers.length; i++) {
if (!passengers.paid) {
console.log(true);
} else {
console.log(false);
}
}