这次给大家带来es6的字符串模板详解,使用es6的字符串模板的注意事项有哪些,下面就是实战案例,一起来看一下。
//ES5方式:
var text = "沧海";
var whole = "蝴蝶再美,终究飞不过" + text;
//ES6方式; 并且支持字符串的查找(支持中文),运算;
var name = "lovely_sr";
var whole1 = `I love ${name}
so much
`;
//{}中放表达式;
var c = 2;
var d = -3;
console.log(whole);
document.write(whole1);
document.write(whole1.repeat(10));
document.write("呵呵");
console.log(whole1.indexOf(name) > 0);
console.log(whole1.includes(name));
console.log(whole1.startsWith(name));
console.log(whole1.endsWith(name));
console.log(`${c+d}`);
console.log(`${c}${d}`);相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
相关阅读:
1、对ASP内核代码进行DLL封装,从而大大提高了用户的访问速度和安全性;2、采用后台生成HTML网页的格式,使程序访问速度得到进一步的提升;3、用户可发展下级会员并在下级购买商品时获得差额利润;4、全新模板选择功能;5、后台增加磁盘绑定功能;6、后台增加库存查询功能;7、后台增加财务统计功能;8、后台面值类型批量设定;9、后台财务曲线报表显示;10、完善订单功能;11、对所有传输的字符串进行安全









