Search code examples
javascriptdocumentationsymbols

How to understand symbols in documentations


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.


Solution

    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.