_.template
Create a template function.
- // Lodash/Underscore
- const compiled = _.template('hello <%= user %>!');
- var result = compiled({ 'user': 'fred' });
- console.log(result);
- // output: 'hello fred'
- // Native
- const templateLiteral = (value) => `hello ${value.user}`;
- var result = templateLiteral({ 'user': 'fred' });
- console.log(result);
- // output: 'hello fred'
Browser Support for String (template) literals
41.0 ✔ | 12.0 ✔ | 34.0 ✔ | ✖ | 28.0 ✔ | 9.0 ✔ |
当前内容版权归 you-dont-need 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 you-dont-need .