one : '0001',
two : '0002',
}
let { item } = this.state;
let quest = item.substr(0, 4)
if (quest !== data.one || quest !== data.two) {
//if this works
}
so this way
if(quest !== data) {
//so it will turn out like this, can you do it or not?
}
If you're trying to do all checks in one comparison and not using many ORs, yes there's a clean approach to do There is a function in underscore package which gives you an array of values in an object so you can do something like if (!_.values(data).includes(quest)){ // Do anything }
Обсуждают сегодня