JavaScript基础
- 字符串的长度以及拼接
- 字符串 + 任何类型 = 拼接之后的新字符串
` console.log('bing' + 18 + '岁'); // bing18岁`
- +号总结口诀:数值相加,字符相连。
`console.log('bing' + 18); // bing18`
`console.log('18' + 18); // 1818`
`console.log(12 + 12); // 24`
- 变量和字符串相连的口诀: 引引加加
var age = 19;
console.log('bingage岁'); // bingage岁
// 我们变量不要写到字符串里面,是通过和字符串相连的方式实现的
console.log('bing' + age + '岁'); // bing19岁
// 变量和字符串相连的口诀: 引引加加
console.log('bing' + age + '岁'); // // bing19岁