<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title> 页面 </title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
//1.检测获取字符串的长度length
var str='my name is LeBron';
console.log(str.length); //17
//2.字符串拼接,字符串+任何类型=拼接之后的新字符串。+号口诀:数值相加,字符相连
console.log('沙漠'+'骆驼'); //沙漠骆驼
console.log('pink'+18); //pink18
console.log('pink'+true); //pinktrue
console.log(12+12); //24
console.log('12'+12); //1212
var age=18;
console.log('pink'+age+'岁');
age++;
console.log('pink'+age+'岁');
var age=prompt('请输入您的年龄');
alert('您今年'+age+'岁了');
</script>
</head>
<body>
</body>
</html>