edit test.html
<div id="test"></div> <script> const p = new URLSearchParams(window.location.search); if (p.has('y')) { year = parseInt(p.get('y'), 10); document.getElementById("test").innerHTML = year; } </script>
test.html?y=1000
result:
1000
My Notebook
edit test.html
<div id="test"></div> <script> const p = new URLSearchParams(window.location.search); if (p.has('y')) { year = parseInt(p.get('y'), 10); document.getElementById("test").innerHTML = year; } </script>
test.html?y=1000
result:
1000