Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove the square brackets "[" and "]" from the syntax #3679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nalinipradash wants to merge 1 commit into javascript-tutorial:master
base: master
Choose a base branch
Loading
from nalinipradash:patch-1

Conversation

@nalinipradash
Copy link
Contributor

@nalinipradash nalinipradash commented Mar 20, 2024

In the syntax for array splice method, the square bracket should not be present.

In the syntax for array splice method, the square bracket should not be present.
@javascript-translate-bot javascript-translate-bot added the review needed Review needed, please approve or request changes label Mar 20, 2024
Copy link
Contributor Author

Another question:

for slice syntax -> arr.slice([start], [end])
Do square bracket serve any special purpose here?

Copy link
Member

Another question:

for slice syntax -> arr.slice([start], [end]) Do square bracket serve any special purpose here?

It's an old convention for "optional".

Mmm...
Should be:
arr.slice( [start] [,end] )

nalinipradash reacted with thumbs up emoji

Copy link
Contributor Author

Ok, then the splice syntax is correct.But it do look confusing.

Should I

  • close this PR
    or
  • revert that change and make change to the slice syntax?

Copy link
Member

smith558 commented Mar 21, 2024
edited
Loading

Hi all, it should actually be arr.splice(start[, deleteCount, elem1, ..., elemN]), as it is. All parameters optional except of the first one. It's a GNU syntax of method signatures for documentations based on BNF. It's a bit obscure and not very beginner friendly, so I was already thinking whether we should adopt a different style such as the one MDN docs are using. Let's keep this open.

nalinipradash reacted with thumbs up emoji

Copy link
Member

I like the brackets, the single line is more clear when you know the brackets purpose.
I suggested a font change just for the brackets. If you paint them gray and slightly bigger, your brain will recognize they are not part of the syntax.
Maybe the dots should be changed too.

But
Consider adopting MDN style.
MDN has influence in the community, a single convention would be user friendly.

Copy link
Member

It may be worth creating a separate article on this syntax so that people can be introduced to it, or at least provide a link. Unfortunately there isn't much resources on this online, there seems to be no standard. The only relevant discussion about this I can find is https://stackoverflow.com/questions/10925478/how-to-interpret-function-parameters-in-software-and-language-documentation.

Copy link
Member

I'd stay with brackets.
Imagine that stackoverflow link example in mdn style.

After "manual and specifications"
Title
"Syntax conventions"
Body
"Square brackets mean optional"
Odd.

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

Reviewers

No reviews

Labels

review needed Review needed, please approve or request changes tell your opinion

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /