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

Partial default arguments

Hemanth HM wrote: var userInfo = (info= { name: 'Mr.Coder', codes: ['js','python','ruby','perl'] }) => console.log(info); userInfo({ name: 'ljharb' }); Would log: {name: 'ljharb'} would it make...

View Article



Image may be NSFW.
Clik here to view.

Partial default arguments

getify wrote: IIUC, to apply default values per property in the params list, you need to destructure the object passed in (which btw you called info in one place and options in the other). But you...

View Article

Image may be NSFW.
Clik here to view.

Partial default arguments

Hemanth HM wrote: Ha, what I meant was info fixed that. I did produced what I needed. Nice, wasn't aware of this construct {name = 'Mr.Coder', codes = ['js','python','ruby','perl']} this has a...

View Article

Partial default arguments

getify wrote: "object destructuring"... here's a link to what I wrote about it: https://github.com/getify/You-Dont-Know-JS/blob/master/es6%20&%20beyond/ch2.md#destructuring Read full topic

View Article

Partial default arguments

Hemanth HM wrote: Awesome, was aware of object destructuring but wasn't aware that we could use the = style within. Read full topic

View Article


Image may be NSFW.
Clik here to view.

Partial default arguments

Hemanth HM wrote: getify: var userInfo = ( {name = 'Mr.Coder', codes = ['js','python','ruby','perl']}) => { let info = {name,codes}; console.log(info); } userInfo({ name: 'ljharb'}); @getify It...

View Article

Partial default arguments

getify wrote: object destructuring (even with defaults) can be nested, even in parameter lists, so you can unwind any arbitrary depth object into top level parameters in your function, then recombine...

View Article

Partial default arguments

getify wrote: BTW, I just wrote up a section in my "ES6 & Beyond" book on this topic, directly inspired by this thread: https:...

View Article


Image may be NSFW.
Clik here to view.

Partial default arguments

Hemanth HM wrote: getify: directly inspired by this thread Wow! Awesome getify: It's not as bad as you might think True, one must get used to this! Thank you! Read full topic

View Article


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 all 12 articles
Browse latest View live




Latest Images