typeof() 使用typeof(变量)可以检测变量是什么数据类型的 注意1: prompt()接收过来的变量是string类型的 注意2: typeof(null)- - -得到结果-object类型 根据控制台字体颜色,也可以判断数据类型: 数字 - - - - - -蓝色 字符串 - - - - -黑色 boolean类型- - -蓝色 undefined和null- - -灰色 NaN- - - - - - -蓝色