The standard before JavaScript ES6 cannot format strings, and you can only use + if you want to concatenate strings
JavaScript ES6 supports the use of $ {variable name} to concatenate strings in strings, where they are automatically replaced. The specific use is as follows:
var name = 'ConstXiong';
var es5Str = 'I am ' + name;
var es6Str = `I am ${name}`;
console.log(es5Str);
console.log(es6Str);
//均输出 "I am ConstXiong"
[Java interview questions and answers] sorting recommendations
- Basics and Grammar
- set
- network programming
- Concurrent programming
- Web
- Safety
- Design Patterns
- frame
- Algorithms and data structures
- abnormal
- File parsing and generation
- Linux
- MySQL
- Oracle
- Redis
- Dubbo