方法默认传参

  • 不推荐 | function showName(name = ‘’){
    console.log(name)} | | :—- |
  • 推荐 | function showName(name){
    name = name || ‘’ console.log(name)} | | :—- |

选择器

  • 推荐

    1. $('.calssName').attr()
  • 不推荐

    1. $('.calssName')[0].attr()