企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
## 1.startWith--返回boolean值 ~~~ let url = "http://www.baidu.com"; let value = url.startsWith("http"); console.log(value); ~~~ ## 2.endWith ~~~ let url = "a.txt"; let value = url.endsWith(".txt"); if(value){ console.log("txt文件") } ~~~ ## 3.字符串模板 >作用:将变量放到字符串中 语法 ~~~ let a = 12; let str = `a${a}bc`; console.log(str); ~~~ 应用场景字符拼串 ~~~ //之前字符串这行要用\(转义字符) let title="good" let str = "<div>\ +title+</div>" ~~~ ~~~ //任意这行,插入变量 let title="good" let str = `<div> ${title}</div>` ~~~