Collect and summarize some new features in Js
(1) Template string
In javascript, it is usually necessary to concatenate multiple strings, which can be concatenated with +
var name = 'varus';
var age = 23;
var message = "你好,我是"+name+",今年"+age+"岁了!";
alert(message);
However, when there are many variables that need to be connected, it is easy to make mistakes with + connection. In ES6, a template string is added to facilitate the operation of strings. Not many browsers currently support it. .
var name = 'varus';
var age = 23;
var message = "你好,我是${name},今年${age}岁了!";
alert(message);