3 ms·
I wish JavaScript would let me declare scoped variables inside if statements like this: if (let myVar = exp) {
by superasn 8y ago
I wish JavaScript would let me declare scoped variables inside if statements like this:
if (let myVar = exp) {
- dan-robertson 8y agoShould this also behave like if-let in rust so if the pattern doesn’t match then it acts as false? E.g if(let [x,y] = thing) ... Would only be true when thing is an array with two elements (not super sure bow pattern matching is defined in ha. I would guess that actually if the match fails then things get to be undefined which means the match can’t really fail so this would likely be confusing)