Page URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_defined
window.location // gives url
const baseRef = location.href.substring(0,location.href.lastIndexOf('/')+1);
console.log(baseRef);
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/
Top comments (2)
Hi, I think an intro and some explanation to supplement the page links and code you've posted would make this post more relevant and useful to others.
Also, to post code, try wrapping the code block with backticks. You can check the editor guide by clicking the ℹ️ icon in the lower left or go here.
Yes you are right. I don't have good grasp of editor used on dev and that's why, not able to write more about it even though i want to. I will learn the editor and then may be start posting something.