ES5中编写函数,为了给参数默认值,必须在函数体内对参数判断,着实揪心。ES6好多了。
<script type="text/javascript"> function run(width = 100, height = 100) { console.log(width + '--' + height); } run(100); </script>
ES5中编写函数,为了给参数默认值,必须在函数体内对参数判断,着实揪心。ES6好多了。
<script type="text/javascript"> function run(width = 100, height = 100) { console.log(width + '--' + height); } run(100); </script>