How JavaScript uses + to convert other types to number types
This article will explain in detail how JavaScript uses + to convert other types into number types. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Use + to convert other types to number types
Console.log (+ '3.14'); / / = > 3.14console.log (typeof +' 3.14') / / = > numberconst sleep = (milliseconds) = > {return new Promise ((resolve, reject) = > {setTimeout () = > resolve (), milliseconds);} / / of course you can consider using console.time to test! Async function main () {const start = + new Date (); await sleep (3000); const end = + new Date (); console.log (`executed ${end-start} `); / / executed 3002} () This is the end of this article on "how to use JavaScript + to convert other types into number types". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.