search

Home  >  Q&A  >  body text

node.js - buf.toString([encoding[, start[, end]]])

encoding[,start
这种语法糖什么意思啊,
是代表start 是可选的,但是如果要使用start参数,必须要有encoding 参数吗?

这个是node 里面特有的语法糖?

迷茫迷茫2784 days ago577

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 14:34:43

    You can basically infer your understanding by looking at the nesting relationship between brackets.

    First of all, encoding is within one [], then she is naturally an optional parameter!

    Looking further, what does encoding, [start] mean? Obviously, it can be felt that when encoding is set, there is an optional start after it.

    This is a common expression:

    Address: usage-message

    reply
    0
  • 黄舟

    黄舟2017-04-17 14:34:43

    [] table is optional, meaning there are 4 parameter modes:

    Empty
    encoding
    encoding, start
    encoding, start, end

    reply
    0
  • Cancelreply