Re:Why is the Zoom app listening on my microphone when not i...
by squeaky-clean on Tuesday February 08, 2022 @09:36PM
(#30267992)
Not the developer but nice catch. const match would be null, not undefined, if the regex search does not match, right?
[ Parent
| on HN ]
Re:Why is the Zoom app listening on my microphone when not i...
by cipherboy on Tuesday February 08, 2022 @09:53PM
(#30268127)
In a browser console:
> const match = /^\/[js]\/(\d+)\/?$/.exec("something")
> undefined
Re:Why is the Zoom app listening on my microphone when not i...
by eatingCake on Tuesday February 08, 2022 @10:27PM
(#30268396)
The assignment to match returns undefined. The value of match is null.
Re:Why is the Zoom app listening on my microphone when not i...
by femto113 on Tuesday February 08, 2022 @10:46PM
(#30268527)
To be pedantic the assignment returns null (always returns the rvalue[1]), it's the const statement that produces undefined[2]
[1] https://tc39.es/ecma262/multipage/ecmascript-language-statem... [2] https://tc39.es/ecma262/multipage/ecmascript-language-statem...
Re:Why is the Zoom app listening on my microphone when not i...
by cipherboy on Tuesday February 08, 2022 @10:47PM
(#30268548)
And to be even more pedantic, the function works because it is applied on an event listener... When null[1] is evaluated (in the right side of the || of the conditional), it produces a TypeError... which in effect (due to no catch and evaluation continuing in a parent/event-driven scope) is essentially equivalent to an empty return in this specific context.
What fun! :-)
Edit: apparently as also mentioned https://news.ycombinator.com/item?id=30268412