I’m not got, yet, with regex. I’ve been trying to break my head to get this to work. I need a regex that allows the user to enter Any alphabetical char (a-z) Any number For special char only “-” and “_”. “@” is not allowed. I got this but no dice. [^a-zA-Z0-9] T…
Tag: javascript
Discord.js: “Unknown Message” when trying to delete a message
This script is meant to send a message that’ll keep track of the process log of a Minecraft server, and as soon as it finishes loading, it should delete the message: but for some reason it just throws me an “Unknown message” error as soon as it gets to the line where it’s supposed to d…
Convert Epoch timestamp to ISO in javascript
I have a function in Java to convert an Epoch date to ISO 8601, but I’ve come across the need to do it in Javascript. I have it somewhat working in JS but it needs to be localized to the timezone. Java version: Param1: -157737600000 Param2: PST Output: 1965-01-01T00:00:00-08 My attempt in Javascript: Es…
jQuery get selected option from combobox [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 5 months ago. Improve this question I ha…
Get array in [[target]] from proxy
How can i get this number from productCount.value (screenshot)? Trying productCount.value.array, but i will get again proxy – [[target]] – array Edit 1: If i use productCount.value.array[0] i will get error Invalid value used as weak map key Answer Trying productCount.value.array, but i will get a…
Looping elements in JSX React
In React.js documentation, I wonder how Array.map() is used in JSX React. in <ul> tag, why we just put the variable listItems directly?. Because I think it will return a single array instead of <li> elements like this : how does JSX treat an array? Did I have to loop listItems manually? Thank you …
“cover” property bugging the background
I am having a problem with covering the background in CSS. Before: Image Before After: Image After Anyone know how to fix this? Thanks! Answer You cannot have cover alone in the background property. You are obliged to define the position as well: Or add background-size: cover Related: Error: CSS: background: …
How to find what variables event listeners send to the functions they call?
I’m having trouble understanding event listeners and what variables they send to the function they call. For example, I added an event listener to this cell with the intention of calling a function which checks if the mouse is pressed down while moving over an element: I was able to make this function w…
How can I return the mode that appeared first in an array in Javascript?
I want to create a function that will return the number with highest frequency(mode). For example: if array contains [10, 4, 5, 2, 4] the output should be 4. If there is more than one mode, I want to return the one that appeared in the array first (ie. [10,2,5, 4, 5, 2, 4] should return 2 because it appeared
Array of components doesn’t update when props change
Codesandbox link I have two components, a Parent and a Child. The Parent components keeps a list of Children in state and renders it using the map method. The parent: The Child: Clicking the “add child” button adds an child to the children array. Clicking the “increment” button updates…