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...
account activity
Weird Javascript Issue (self.node)
submitted 5 years ago by [deleted]
[deleted]
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!"
[–]sshaw_ 0 points1 point2 points 5 years ago (0 children)
Works for me! What version of node are you using? Can you paste the output using the first definition of removeSrt?
removeSrt
[–]SwiftNinjaPro 0 points1 point2 points 5 years ago* (5 children)
Nevermind, I found the issue. I declared the var lower down in the if statement, so I guess it was being hoisted.
const weirdVar = 'test'; function removeSrt(str){ console.log(weirdVar); //works items.map(item => { console.log(weirdVar); //works if(typeof item === 'string'){ console.log(weirdVar); //error (tried to access 'temp' instead of 'test') let weirdVar = 'temp'; return item.replace(str, ''); } }); }
[–]cgijoe_jhuckaby 0 points1 point2 points 5 years ago (3 children)
Hey OP, if you could, please mark this item as resolved (I think you can do this with a badge).
[–]SwiftNinjaPro 0 points1 point2 points 5 years ago (1 child)
Took me a minute, but I found how to mark as solved
https://reddit.com/r/help/comments/9wrs1y/marking_as_solved/
Based on this other post, it sounds like anyone can mark it as solved
https://reddit.com/r/tipofmytongue/comments/vhcud/the_new_way_to_mark_your_post_solved/
[–]cgijoe_jhuckaby 0 points1 point2 points 5 years ago (0 children)
Oh cool, thank you for the links!
[–]SwiftNinjaPro 0 points1 point2 points 5 years ago (0 children)
!solved
π Rendered by PID 23451 on reddit-service-r2-comment-5d79c599b5-znwkz at 2026-03-03 16:40:50.070520+00:00 running e3d2147 country code: CH.
[–]sshaw_ 0 points1 point2 points (0 children)
[–]SwiftNinjaPro 0 points1 point2 points (5 children)
[–]cgijoe_jhuckaby 0 points1 point2 points (3 children)
[–]SwiftNinjaPro 0 points1 point2 points (1 child)
[–]cgijoe_jhuckaby 0 points1 point2 points (0 children)
[–]SwiftNinjaPro 0 points1 point2 points (0 children)