Skip to content
Advertisement

Category: Questions

RegExp.prototype.exec() can loop forever

Steps to reproduce: Open the MDN docs page: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec. Open ‘Developer Tools’ and switch to the Console tab. Replace foo* with .* on the docs page and click ‘Run’ button. This will result in an infinite loop. How do I prevent this from happening? In my Node application, the user can specify .* as the pattern and it hangs. I

Identify origin of an observable event on subscription

I have a BehaviorSubject<Array<user>> (userListSub$) state that is updated from various places. For example, when I click Follow on a user when I click Unfollow on a user when I favorite a user The same state is being subscribed in different components. I would like a particular component to not react to an event emitted by the state (userListSub$) if

Persist the login state in Next js using localstorage

I’m writing an authentication application in Next Js (v12.2.5). The application also uses React (v18.2.0). The problem is with persisting the authentication state. When the browser is refreshed, the login session is killed. Why is this happening even though I am getting and setting the token in the local storage. I would like to persist the login session to survive

ASP.NET JavaScript Always Shows Default Alert Message

Despite of JavaScript located in ASP.NET Core Page (cshtml), getting always a default message like “Changes Are Made…” from EDGE Browser (or CHROME is the same). Is there a way to use Custom Message? I have already seen similar questions in SO, but none of them supplies a solution… EDIT Browsers absolutely prevent User Custom Message, reasonably. Then decide when

Having black coloured labels for pie chart in vega lite

I was referring to pie chart examples of vega-lite. I modified one of them to show percentage values as follows: This works perfectly and renders following: However, I wanted those percentage labels in black color. So I referred text mark and tried following: But this does not makes any changes to above output. I also tried putting color as encoding:

Advertisement