What does * mean in the function signature _.extend(destination, *sources) See here for an
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is notation borrowed from Python (search for “If the form “
*identifier” is present”): it means that the formal parameter tagged with the asterisk will consume as many actual arguments as are left over after all other parameters are satisfied. In Python, “as many as are left over” may be zero without error; I don’t know if that’s the case in underscore.js (which is implementing these semantics on top of the rather more primitive Javascript variadic function mechanism, so it can do whatever it likes).