Lets say I have an array of products: and I have another, smaller array where I store the order of the products on my page: And I want my Products array in such a way they are ordered like the orderItems array defines, like so: and I want the products who do not have a corresponding orderItem to be at
Variable coming up as undefined when called outside of a function, but working when called inside the function
I have a function that creates an html dom modal window with a textbox and a button that closes it. When the close button is clicked, the value of the textbox is stored in a variable. The variable (as far as I know) is global, and is not limited to inside the modal window function. I have it set up
Instagram embed: React’s JSX doesn’t support namespace tags
I was trying to embed an Instagram post on my React website but I encountered the error “Namespace tags are not supported by default. React’s JSX doesn’t support namespace tags. You can set throwIfNamespace: false to bypass this warning.” Where am I supposed to set throwIfNamespace: fa…
How to allow a user to query all rows or just selected ones?
I’ve been looking for this but i have no idea about the name of this. I am creating a data model on MySql and i have a table called users and i want to restrict the queries from each user, for example, allow to read all the rows from the clients table or only allow them to query some selected
How to validate that an array with dates is arranged newer to older and vice versa
I am still very much a newbie to JS and had a question for which I cannot find an answer for. I have an array such as: The actual array is much longer. I need to do a for loop (if best) to check if the dates are arranged in a newer to older or older to newer manner. I
VueJS 3 / Vuex – How to display data from a nested json result
Dears, I’ve been struggling with this for hours, even following basics tutorials. I’m trying to display some data in Json in my Vue 3 project, when a data is in an array, using a loop I get everything I need, but if it isn’t in an array, I get an error or the data are stick together. I’…
SetState inside useEffect is causing side effects on select input functionality
Each select menu comes with a help text inside a box. Similar to a tooltip. User can close them when clicking ‘close button’ or clicking outside. My solution works and they are being closed each time you click outside them. The problem is that setState inside the useEffect has a side effect on the…
Javascript check if object is in another object and match length to other objects keys
I apologize for the title. I’m not really sure how to best word this as I’m still learning Javascript. I have an object of dates that have an occurence of dynamic values as follows: (Key = date, value = number) I also have another object that looks something like this: Basically, I need the second…
Proper way to perform an API call inside div?
So I am currently trying to display data in a table. This data is from 2 separate tables in the database with foreign keys. I get my list using this call: So I can get the list of Stores and can display them in the table with no issue using this code: Now I want to run this API inside
C# Replacing weirdness
I have an annoying problem with replacing in C#. I have an array with what letter i should to replace with: That’s basically a file output that splits to array Next a have this loop: That should replace it right, according to the JS Can you help me re-writing this exact thing but with C#? I don’t …