I'm still getting used to the best practices for Javascript. I would like to know what would be the best way to shorten the following if statement, possibly even in one line. How would I go about that?
onSelect: function (sortOption) {
this.activeOption = option;
if (option.value === null) {
this.tableData = this.$props.trashList;
} else {
this.tableData = this.$props.trashList.filter(item => item.isToggle === option.value);
}
},
Aucun commentaire:
Enregistrer un commentaire