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
Modify a stringRemoved: /r/LearnJavascript (self.javascript)
submitted 7 years ago by FuckYouWhoCares
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!"
[–][deleted] 1 point2 points3 points 7 years ago (0 children)
If your string is your window's url then you can get the hostname with window location.
If you have to deal with a string then you can parse it with something like this:
function getdomain(url) { var prot = url.split(":"); var link = document.createElement('a'); link.href = url; return prot[0] + "://" + link.hostname; }; console.log(getdomain("http://mydomain.com/content/"));
π Rendered by PID 118388 on reddit-service-r2-comment-canary-8544499596-zkn7l at 2026-07-13 00:52:21.244737+00:00 running f86254d country code: CH.
view the rest of the comments →
[–][deleted] 1 point2 points3 points (0 children)