zoukankan      html  css  js  c++  java
  • String 的扩展方法

     

       // let name = `这是一个模板字符串`;
            // console.log(name);

            let name = `张三`;
            let sayHello = `Hello,我的名字叫${name}`;
            console.log(sayHello); // Hello,我的名字叫张三
     
     
     
      let html = `
                <div>
                    <span>${result.name}</span>
                    <span>${result.age}</span>
                </div>
            `;



            // <div>
            //         <span>张三</span>
            //         <span>20</span>
            //     </div>
            console.log(html);
     
     
      const fn = () => {
                return '我是fn 函数';
            }
            let html = `我是模板字符串 ${fn()}`;
            console.log(html); // 我是模板字符串 我是fn 函数
     
     

      let str = 'Hello ECMAScript 2015';
            let r1 = str.startsWith('Hello');
            console.log(r1); // true
            let r2 = str.endsWith('2015');
            console.log(r2); // true
     
     
      let str = "y".repeat(5);
            console.log(str); // yyyyy
  • 相关阅读:
    clion打断点不生效
    PHP加密解密
    细说MySQL表操作
    细说MySQL数据库操作
    终端(命令行)连接MySQL
    MySQL结构
    求1!+(1!+3!)+(1!+3!+5!)+...+(1!+3!+5!+7!+9!)的值
    react 生命周期
    React TS 组件 Demo
    react-redux 实现原理
  • 原文地址:https://www.cnblogs.com/ericblog1992/p/13074085.html
Copyright © 2011-2022 走看看