JavaScript杂货
幂运算
// 求x的y次幂
Math.pow(x,y)
拼接html文本
使用`符号拼接文本时。没个li对之间必须有个空格,不然可能会样式错误
- 正确用法(li结束标签后加上一个空格)
htmlStr += `<li id="div_` + code + `" class="link required" offercode="` + code + `"> `
htmlStr += ` <div class="content link"> `
htmlStr += ` <div class="main e_red">` + name + `</div> `
htmlStr += ` <div class="more"></div> `
htmlStr += ` </div> `
htmlStr += `</li> `
- 可能存在问题用法
htmlStr += `<li id="div_` + code + `" class="link required" offercode="` + code + `">`
htmlStr += ` <div class="content link">`
htmlStr += ` <div class="main e_red">` + name + `</div>`
htmlStr += ` <div class="more"></div>`
htmlStr += ` </div>`
htmlStr += `</li>`