JS | Web Dev | Web Frontend

JS Get Query String In URL

Handy way to get query string value in URL Example URL: https://www.example.com/index?query1=result1&query2=result2 const params = new URLSearchParams(window.location.search); // window.location.search is showing ?query1=result1&query2=result2 // then we can use the params.get(‘{paramName}’) for getting the query param console.log(params.get(‘query1’)) // result: result1 console.log(params.get(‘query2’)) // result: result2 For note: The query string value must be without hash (#). Try it […]

Continue Reading...


JS Intersection Observer API For Lazy Loading Image

Intersection Observer API can be used to detect intersection between two elements. The most common case to use is lazy loading image.Lazy loading means we load the image when it’s needed, in common case is when the image is shows up in the browser viewport. Note: When testing it, you may notice the intersection callback […]

Continue Reading...