Closed Turro75 closed 3 years ago
And a quick note about ranges for switch in JavaScript: it is possible, but in a weird way. For example:
switch (true) {
case i === 0: return "zero";
case i > 0 && i < 10: return "single digit";
case i < 100: return "two digits";
default: return "big number!";
}
But I don't think it's a good practice. Using an if
statement is probably a better solution, especially in our case.
p.s. there's also a proposal for new JavaScript syntax that will probably able to deal with ranges. But it's just an early stage proposal right now...
Thanks!
I choose to avoid 32 spinlocks cases by inserting if statements in both read/writeUint32