3 ms·
This is how a language can be a mess: [] + [] = '' [] + {} = '[object Object]' {} + [] = 0 {} + {} = NaN Array(16).join('wat' - 1) + ' Batm
by yencabulator 3y ago
This is how a language can be a mess:
[] + [] = ''
[] + {} = '[object Object]'
{} + [] = 0
{} + {} = NaN
Array(16).join('wat' - 1) + ' Batman' = 'NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman'
https://www.destroyallsoftware.com/talks/wat https://www.destroyallsoftware.com/talks/wat
- mardifoufs 3y agoYou can find examples like these for basically every single language.
- lifthrasiir 3y agoThis is misleading, as the original talk executed them in the statement context where the preceding `{}` is an independent statement. `({} + [])` etc. are much more consistent.