3 ms·
I knew that it was a string. If you listen closely, you'll hear that he asked "is that an array of object?" He probably asked that because it's in square bracke
by gary_bernhardt 12y ago
I knew that it was a string. If you listen closely, you'll hear that he asked "is that an array of object?" He probably asked that because it's in square brackets. I said "No, it's just an object".
I've probably seen twenty people call this "wrong", which frustrates me. It's not wrong. It was a stringified object! I didn't say "stringified" because it wasn't relevant to the question of whether the object was in an array!
There are other things in Wat that are genuinely wrong, though, like the fencepost error about "16 commas", which mistake will haunt me forever.
- saraid216 12y agoMaybe worth releasing a transcript, at this point?
- hetid 12y agoIt's only 15 commas man, 15 commas. That extra comma could kill someone. Speaking of which, why does WAT do different things on node.js?
- Turing_Machine 12y ago"That extra comma could kill someone." Only in old versions of Internet Explorer.
- espadrine 12y ago> why does WAT do different things on node.js? Wrapping the same input in parenthesis (eg, '({} + [])') yields different results.
- calibwam 12y agoIt is wrong because it is the toString of Object, because the + operator wants to do string concatenation. You were misleading the audience, both by using a shell which doesn't show strings with quotes, and saying that the toString of the object is 'just an object'. And that is not the only thing that is misleading, as you clealy said that {} was an object. Yes, the syntax in js is weird as it looks like an object, but it isn't. Again, a better shell would not let you do this.
- nilliams 12y agoAs gary explained he wasn't wrong in his response to the question because the audience member was asking whether [object Object] means the object is in an array. It doesn't. The string point is moot. I do agree the {} + [] example has always felt a bit unfair to me (for the reason that {} is a block), but whatever, it's a light-hearted talk.