You have a value in JS. You need to cast it to a String. What do you do?
-
Show this thread
-
Seems like ~most people use String(...), which is good. It's the most direct way of calling the internal ToString() method which sensibly stringifies primitives and attempts [Symbol.toPrimitive](), toString(), valueOf(), in that order.pic.twitter.com/Fw92MCnAXI
4 replies 4 retweets 27 likesShow this thread -
Revised to include Symbol() gotcha (thanks
@mathias)pic.twitter.com/7YHJLKJgLg
3 replies 3 retweets 7 likesShow this thread -
Any substantial difference in performance between these options?
1 reply 0 retweets 0 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.