0

I'm trying to get a good sense of reading documentation instead of asking so many questions here and there.

The first thing i'm confused of is the symbols.What do the symbols below mean?



example) app.use([path,] callback [, callback...])

reference source:https://expressjs.com/en/5x/api.html#app.use


Question1&2 can be solve by the similar posting.

    1. Another example is like

bisector.left(array, x[, lo[, hi]])

  • what does x[, mean?
  • what does **lo[,**mean?
  • what does ,hi] mean?

reference source: https://devdocs.io/d3~5/d3-array#bisect

It would be very grateful if anyone could help me to under stand these cryptic symbols.

BS100
  • 823
  • 6
  • 22
  • @jonrsharpe to some degree yes, but not fully. But thanks for the link – BS100 Dec 20 '20 at 18:21
  • 2
    Then [edit] to clarify what else you want to know. – jonrsharpe Dec 20 '20 at 18:21
  • @jonrsharpe I think even if number 1&2 might be answered by the link you gave me while the number 3 quesiton can't be answered by the link, I think it's okay to leave number 1&2 as well to make it super crystal clear. If you don't like it, i can delete too. but it would be grateful if you allow me to leave it as it is. – BS100 Dec 20 '20 at 18:31

1 Answers1

0
  1. [xxx] means that this parameter is optional. You can use it or omit it.
  2. [callback] is also an optional parameter. In this case it's a function that will be called under some circumstances.
  3. Nested bisector.left(array, x[, lo[, hi]]) means that you need to have some options before you can specify others. For example, you cannot specify lo in this case without specifying hi first.
IvanD
  • 2,728
  • 14
  • 26
  • How do i know "need to have some options before you can specify others"? since its written within x[ ]? or lo[ is opend square bracket?? – BS100 Dec 20 '20 at 18:24
  • 1
    In case of this example, you can know it by the fact that the square brackets are nested. Since `array` and `x` are mandatory, you have 3 options there: `array+x`, `array+x+lo`, and `array+x+lo+hi` – IvanD Dec 20 '20 at 18:45
  • understood. but 1. how do I know which could be x like "x should be an array or x should be a string or just variable? 2. how do I know 'lo[, hi] means what could come within the optional bracket is [lo,hi]?If i understand it correctly. 3. what does the first comman mean within the bracket? , which is [, before lo[, and hi]. the link jonrsharpe provided says , at the beginning means everything should be linked by ',' but i don't get the , within [ , lo[, hi] ]. Thank you a lot. – BS100 Dec 20 '20 at 18:59
  • 1
    1. This notation does not tell you the type of variable, it's usually written somewhere below in the docs; 2. Not sure I understand; 3. A comma is a delimiter between the arguments, when it's inside the bracket, it means that you add this comma only when adding an optional argument – IvanD Dec 20 '20 at 19:20