摘要: 1,带参数默认函数 function add(a=10,b=20){ return a+b; } add(); 2,默认表达式也可以是个表达式 function getVal(val){ return val + 5 } function add(a=10,b=getVal(5)){ return 阅读全文
posted @ 2022-05-06 07:55 博星 阅读(32) 评论(0) 推荐(0) 编辑
摘要: const oBox = document.querySelector('.box') let id = 2; oBox.innerHTML = `<div id=${id}> haha</div>` 类似占位符 模板字符串:使用tab键上的反引号``,插入变量时使用${变量名} 阅读全文
posted @ 2022-05-06 07:05 博星 阅读(23) 评论(0) 推荐(0) 编辑