Quantcast
Channel: Why can't "?" be used in variable or function names
Browsing latest articles
Browse All 12 View Live

Why can't "?" be used in variable or function names

Hey, I'm new here I'm sorry if I'm stepping on any rules. Just have a dumb question, why can't the question mark character be used in JS as a variable or function name? I understand that there use for...

View Article


Why can't "?" be used in variable or function names

My wild guess is that question marks are not allowed in identifiers for the simple reason that it is uncommon among programming languages to allow punctuation marks in identifiers. There is probably...

View Article


Why can't "?" be used in variable or function names

It isn't because no-one proposed it. If proposed, it would introduce an ambiguity with the ternary ( ? : ) operator. E.g., what does f? g?h:i; mean? Is it the same as f ? g?h : i; // ternary operator...

View Article
Browsing latest articles
Browse All 12 View Live