1-1

  1. //1.行内
  2. <div onclick="alert(1)">div</div>
  3. //2.内嵌html页面中

1-2string,boolean—>number

  1. Number();

1-3string—>number

  1. 特点:只能识别纯数字的字符串,其他的输出NAN
  2. var str ="3";
  3. console.log(Number(str))//3
  4. console.log(Number("3.o"))//3
  5. console.log(Number("3px")) //NaN

1-4boolean—>number

  1. 特点:0识别为false,其他的都为true

1-5number,string—>boolean

  1. Boolean();

1-6numder—>boolean

  1. 特点:0识别为false,其他的都为true

1-7string—>boolean

  1. 特点:""识别为false,其他都为true

1-8any-string

  1. string();
  2. string();
  3. tostring();