thecodingaviator on master
remove A (#31157) (compare)
cards.filter(card=> card.type == "awards")
cards.filter(card=> card.type === "awards")
cards.filter(card => card.type)would also keep all cards provided that types are non-empty strings.
cards = cards.filter(card=> card.type == "awards" || doAll );- the variable
doAllwould be set to
false(or something that evaluated to true or false) and if it did not match the first conditional test, then if
true, it would add the card to the output array. It is the
||"or" condition that makes it work. It is a common way to affect conditional tests. So it will work, but it might not always be the best way to do things, for example, if you have a 1000 element array that you don't need to filter, then maybe it is not too efficient to do this (just thinking of performance).