问题描述:

This question already has an answer here:

  • Is there a better way to do optional function parameters in Javascript? [duplicate]

    29 answers

网友答案:

Use

if (typeof val === 'undefined') val = true;
相关阅读:
Top