<!DOCTYPE html>
<html lang="zh">

    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>js传递默认参数</title>
    </head>

    <body>

        <script type="text/javascript">
            function add({

                namespace = 'sti-vux-',
                storage = 'localStorage',
                persistence = []
            } = {}) {
                //使用传递的参数namespace
                console.log(namespace + 55555)
                //使用传递的参数persistence
                console.log(Array.isArray(persistence))
            }
            add();
        </script>
    </body>

</html>

 

相关文章:

  • 2021-09-13
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2021-09-01
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-09
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-01
相关资源
相似解决方案