A
A
alexander rodin2018-02-05 15:16:46
JavaScript
alexander rodin, 2018-02-05 15:16:46

What does it mean to write arguments to a function like function(num1[, ...[, numN]])?

How to understand such a record?
Square brackets and commas at the beginning are confusing, I would like to know why they write it that way.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2018-02-05
@lieflowerme

square brackets in help and examples indicate optional parameters.
that is
, it says that it can be both
function(1) and function(1,1,1,1,1)
And for example, a record like:
means that x, y are mandatory parameters, z is optional. Therefore, you can call both
function (1,2) and function(1,2,3), but not function(1,2,3,4)

R
Rsa97, 2018-02-05
@Rsa97

An optional part is written in square brackets.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question