Skip to content

Conversation

@SpliceReborn
Copy link

The square brackets in 'Object.assign(dest, src1[, src2, src3...])'
results in a syntax error. The correct syntax should be
'Object.assign(dest, src1, src2, src3, ...)', but I've added a srcN, changing it
to 'Object.assign(dest, src1, src2, src3, ..., srcN)' to make it more relevant
to the explanation found underneath the original code snippet.

The square brackets in 'Object.assign(dest, src1[, src2, src3...])' 
results in a syntax error. The correct syntax should be 
'Object.assign(dest, src1, src2, src3, ...)', but I've added a srcN, changing it 
to 'Object.assign(dest, src1, src2, src3, ..., srcN)' to make it more relevant
to the explanation found underneath the original code snippet.
@CLAassistant
Copy link

CLAassistant commented Sep 8, 2022

CLA assistant check
All committers have signed the CLA.

@iliakan
Copy link
Member

iliakan commented Sep 20, 2022

How shall we tell people that [...] is a special "cross-language" syntax for optional arguments?

The same question again and again...

@joaquinelio
Copy link
Member

joaquinelio commented Sep 20, 2022

[ ] ...
play with size, font, color,
add as md.
color wont do well as editors highlight syntax that way,
but, maybe, grey and a little oversize will tell the brain there is smthing out of place

or,
you submit and use mdn way

@iliakan
Copy link
Member

iliakan commented Oct 1, 2022

@joaquinelio You mean, write it as Object.assign(obj, ...sources)? May be a better choice, indeed! ;)

@iliakan iliakan closed this in c99d740 Oct 1, 2022
@joaquinelio
Copy link
Member

joaquinelio commented Oct 2, 2022

oh!
It's an idea, a font that means it's not real code
far easier to implement.

I meant individual format
Object.assign(dest, src1 [ , src2, src3...] )
(well, I tricked it, the format should be in the brackets graying them, not the code)
Object.assign( dest, src1 [ , src2, src3...] )

@iliakan
Copy link
Member

iliakan commented Oct 2, 2022

even if we make the brackets look different, people who don't know what they mean will still be confused.

@joaquinelio
Copy link
Member

yep
more and more I'm convincing myself the [ ] is not a friendly tool for newcomers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants