当前位置: 动力学知识库 > 问答 > 编程问答 >

Javascript: check if variable is false or if it doesn't exist at all

问题描述:

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;
分享给朋友:
您可能感兴趣的文章:
随机阅读: