数据类型3

 

 

   // 1 检测获取字符串长度  length
        var str = 'my name is    eric';
        console.log(str.length); // 18 包含空格
 
 
 

 

 

  //  2 字符串的拼接  +  (只要有字符串 和其他类型的拼接 最终的结果是字符串类型)
        console.log('沙漠' + '骆驼'); //沙漠骆驼
        console.log('Eric老师' + 28); // Eric老师28
        console.log('Eric' + true); // Erictrue
        console.log(12 + 12); // 24
        console.log('12' + 12); // '1212'
 
 
 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2020-06-03 17:48  EricBlog  阅读(94)  评论(0编辑  收藏  举报