4 ms·
"but isn't this more counter-intutive than the original addition method?" I disagree. The original statement (using + or using |) isn't very intuitive to most
by jeresig 17y ago
"but isn't this more counter-intutive than the original addition method?"
I disagree. The original statement (using + or using |) isn't very intuitive to most web developers. Why would you add (or concatenate?) together a text node and a comment node? For that matter, why would you OR them together? I think you're pretty close to noting a better approximation (e.g. passing in a string "ELEMENT, COMMENT, TEXT") - but that would require defining a spec for how the string should be parsed, which is also messy. It just makes a lot more sense to just use a variable number of arguments (which JavaScript is designed to handle gracefully).