宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取

小编给大家分享一下js如何实现转字符串,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

转字符串

const input = 123;

console.log(input + ''); // '123'
console.log(String(input)); // '123'
console.log(input.toString()); // '123'