+ 3
Get just name from url with JavaScript
i want to JavaScript function that take url as parameter and return just name from url, for example; parameter url: https//:www.facebook.com/something or https//Facebook.com/something or www.facebook.com/something or facebook.com/something and i want get return just facebook or facebook.com
2 ответов
+ 6
two methods: one using new URL(url) and one using regex which is more flexible (can probably make a better regex than this one)
https://code.sololearn.com/WwAkr4Nds2GN/?ref=app
+ 1
good job bro