Printing complex strings in javascript without + symbol

> **Possible Duplicate:** > [JavaScript equivalent to printf/string.format](https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format) Is there a more C like way to print complex strings in javascript, preferably one which doesn't require large numbers of the `+` symbol and accompanying `""`? **I want this:** console.log ( "Name: %s Age: %s Sex %s Wieght %s Height %s", name, age, sex, weight, height ); **Instead of this:** console.log ( "Name: " + name + " Age: " + age + " Sex: " + sex + " Weight: " + weight " Height: " + height );

以上就是Printing complex strings in javascript without + symbol的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏