I am creating a loader. Since I use Firebase, I need to load the specific script files dynamically in the exact order. Here are the code in my HTML files. JsPack.js is a loader that will load specific scripts one at a time. And here is my current jsPack.js file. This works perfectly in the exact order. Howeve…
Sorting Algorithm for Tasks with Dependencies in a Gantt Chart
I’m building a Gantt Chart with dhtmlx-gantt that contains parent and child tasks. A parent task can be a dependent on another parent or child task A child task can be dependent on another child or parent task Tasks can have multiple dependencies A dependent task can only begin once it’s ruling ta…
Translating Curl Request with Form Data to Axios
I’m trying to mimic the following request using axios: More information: https://developer.capitalone.com/documentation/o-auth I came up with the following code: This keeps timing out and not giving me any response, which leads me to believe my request is malformed. Am I doing something wrong in trying to cre…
JS: convert 2D matrix into another?
I have a 2D matrix with an -1000 to + 1000 X/Y coordinate system. For plotting purposes, I want to transform that into another coordinate system, where 0,0 is at the top left. Any idea how to do that? I know how to do a linear projection of a single axis, but doing that independently yields distortions, espec…
Number with too many decimal places ends up in scientific notation
I am getting a price from a 3rd party API which is returned in scientific notation. When I actually check this price on their site, its shown as 1.20 but the api returns 1.2052626e I want to perform a multiplication with that price field and format it to a currency string but it always returns as 0.00 cause o…
How to fetch the dropdown value in edit form using jquery?
I have a form with dropdown in it and when I am adding the data it is going to database. When I click on edit I can fetch the values of all other fields but the drop down is not showing the value which was added previously in the dropdown can some one please help ?? I am trying to
Add array to Object
I have a collection of inputs I’m trying to loop through all of these inputs to create an object with keys exactly the same as names in my inputs and add those values as values. So my steps are: EDITED the expected output should look like this: Answer You can iterate over the input elements in chunks of…
JavaScript Accessing literal object property
I’m trying to make this function that tells me which guitar I can purchased based on the budged. My issue is that I created a literal object and all outputs are giving the same answer (Except condition one) because I am trying to access the properties inside. What would be the best way to access the pro…
Pass onClick to each image using map function
I am looking to pass an onClick function to each image element created using the map function. So that when a user clicks the thumbnail image it changes the main image to the thumbnail that was clicked. Right now however it seems like the onClick function is being called without even being clicked and the ima…
How to create a JS file with a command DISCORD.JS
I’m making a discord bot and I was wondering if you can create a .js file with it. I haven’t found a way to do it. My command reacts to &createfile {name} and it will always create a .js file. My code so far: Answer Simply use the built-in fs module. It is built into node, so it doesn’t …