Skip to content

Why use of a WeakSet in detecting circular references make sense?

I’m trying to understand the example given by WeakSet documentation here. In the doc it says: The WeakSet is weak, meaning references to objects in a WeakSet are held weakly. If no other references to an object stored in the WeakSet exist, those objects can be garbage collected. Object foo is defined ou…

Remove clicked marker Leaflet

I want to create an interactive map in html/js with Leaflet. I have a function that creates markers on click : Now, I want to remove markers when I click on them. However, I cannot find the way to do that. Is there a way to fetch marker id and remove it with a specific method ? Answer You need

How to replace specific links in a webpage using Javascript

I am trying to make a chrome extension script that scans a webpage for specific clickable links, and replaces them with other links if they match. Here is what I have since updating this post with a minimum reproducible example (updated farther below) but it only works for function rewritePage1 which is based…

Why hashing the reset password token?

I have this forgot password handler in my Express app. I send an email with a crypto.randomBytes(20).toString(“hex”) token, that I use later to verify the request. It is working perfectly. However, I have seen that people are hashing this token before sending it and storing in the data base, and I…

how to change with javascript

I have a Javascript function that I been dealing with for a few hours, Javascript: HTML: CSS: The <li> tag is meant to act as a button, and it does everything in the function, (changes .svg Icon and plays the music) but the second time I click it again, nothing happens. I also checked the console, and n…