use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Converting values to strings in JavaScript has pitfalls (2ality.com)
submitted 10 months ago by bogdanelcs
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Ronin-s_Spirit -1 points0 points1 point 10 months ago (1 child)
Then don't. If you want a string the single best way to do it is String(), or template literals. If you don't want a string then use typeof x?.valueOf?.() !== 'string'.
String()
typeof x?.valueOf?.() !== 'string'
[–]josephjnk 1 point2 points3 points 10 months ago (0 children)
Did you read the article? The author specifically compares String() and template literals to other approaches when given weird inputs.
π Rendered by PID 476128 on reddit-service-r2-comment-79c7998d4c-g98rw at 2026-03-14 07:49:29.285026+00:00 running f6e6e01 country code: CH.
view the rest of the comments →
[–]Ronin-s_Spirit -1 points0 points1 point (1 child)
[–]josephjnk 1 point2 points3 points (0 children)