正常字符串使用“”或者‘’包着

多行字符串编写

  1. <script>
  2. 'use strict';
  3. let str=`hello
  4. word
  5. 你好呀
  6. 我很好
  7. `
  8. </script>

模板字符串(只要``号里面支持,””和’’不支持)

  1. <script>
  2. 'use strict';
  3. let str01="hello";
  4. let str02="word";
  5. let str=`你好呀,${str02}`
  6. </script>

字符串长度

  1. <script>
  2. console.log("student".length)
  3. </script>

image.png

大小写转化

  1. <script>
  2. "student".toUpperCase();
  3. "STUDENT".toLowerCase();
  4. </script>

还有很多Java中的方法js中都可以用…