Python

Python ‘switch case’ Statement: A Complete Guide (match case)

Python switch-case statements are here as of Python 3.10! These statements are actually called match-case statements. With a match-case statement, you can get rid of rather verbose if-elif-else chains like this: Instead, you can use a compact match-case expression to do the exact same: In some situations, the latter approach is better. It can make …

Python ‘switch case’ Statement: A Complete Guide (match case) Read More »

How to Get Current URL in JavaScript [with Useful Examples]

To get the current URL of the page you are visiting using JavaScript, access the window.location.href property: Alternatively, you can access the current URL via document.URL property. However, it has some shortcomings that I’ll explain in a bit. Let’s take a closer look at the window.location object. It has useful properties other than the href …

How to Get Current URL in JavaScript [with Useful Examples] Read More »