(10 || 9 || 8)
and it is 10 since Boolean(10) === true
.(8 == <previous result>)
, that is, 8 == 10, and it is equal to false
.x === 1 || x === 2 || x === 3
x >= 1 && x <= 3
Set
(better than an array):let values = new Set(['215', '456', '766', ...]);
function some(x) {
// ...
if (values.has(x)) {
// ...
}
}
if (![10, 9, 8].includes(8)) ...
if ((8 == 10 || 8 == 9 || 8 == 8) === false) ...
// for the adequacy of the example to replace 8 x
if ((x === 10 || x === 9 || x === 8) === false) ...
if (!(x === 10 || x === 9 || x === 8)) ...
Find more questions by tags JavaScript
includes can be replaced by:
if ([10, 9, 8].indexOf(8) === -1)...
- idell_Kassulke commented on June 8th 19 at 17:33