js build up string

Posted 戴杭林

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js build up string相关的知识,希望对你有一定的参考价值。

// bad
function sayHi(name) {
  return ‘How are you, ‘ + name + ‘?‘;
}

// bad
function sayHi(name) {
  return [‘How are you, ‘, name, ‘?‘].join();
}

// bad
function sayHi(name) {
  return `How are you, ${ name }?`;
}

// good
function sayHi(name) {
  return `How are you, ${name}?`;
}

 

以上是关于js build up string的主要内容,如果未能解决你的问题,请参考以下文章

js常用代码片段

Jenkins打包后续:Shell脚本自动修改build号,并提交TestFlight

read ECONNRESET at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20) { errno: -4077(代码片段

环境初始化 Build and Install the Apache Thrift IDL Compiler Install the Platform Development Tools(代码片段

Failed to convert property value of type ‘java.lang.String‘ to required type ‘int‘ for property(代码片段

dockercompose up build fail