For some reason NW.SHELL fuctions are only working for files in root folder of my app. It wont let me use an absolute path or a relative path. Example “/relative/path/text.txt” or D:/relative/path/text.txt however text.txt will work with NW.SHELL function as long as the text file is in the same ro…
What is the difference between throw Error(error) and throw error
What is the difference between: and Also Is the second one necessary? It seems like you are just wrapping an error with an Error Object. Which one is preferred? Please help me understand. Answer It’s possible that the value that the Promise rejected with was not an error object, but something else: Doin…
When fetching JSON and inputting the data into variable, it gives me undefined is not iterable (cannot read property Symbol(Symbol.iterator))
I’m using the Advice Slip API. As the title says, when I input the JSON data into the variable, like this: It gives me the error that I mentioned. However, when I replace .then(adv => advi = adv) with .then(console.log) it gives me an object with the advice. However, since I don’t want to just …
Compare an array with 0 in JavaScript
I was going through my company’s code base and found a statement that compares an array with 0 like this: array > 0; if we let array = [“1”], which has a single element, the above statement would be true; but if let array = [“1”, “2”] or [], the statement would bec…
Sending variables to a php script for database from java script
First, I have looked at just about every other question here on this subject but I can’t find anything like I need. I’m trying to send the userId for one signal to a PHP script to put it in a database. I have tried many different versions of this. Here is the script that does send to the PHP scrip…
How to get these 2D array elements summed if there are duplicates?
I have seen a couple of examples, but handling arrays with 2 elements in it and I was wondering what changes would have to be made so that this one gets summed by comparing the first element and calculating the 4th elements Expected Result Appreciate your help! Thanks! Answer Just update the array indices of …
get array of object value and nested array of object value
I’ve this nested array of object array: How can I get the ids base on selected property? I manage to get the first level, I’ve tried but how can I select the ids which is in the subItems? I expect the result to be [1, ‘2a’, 3] Answer Flatten the array first. Be careful of using &&a…
Use an object attribute to create an array with it [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 months ago. Improve this question Hi guys i want to do something “simple” but not for me, I hav…
getDoc values Firebase React
This should honestly be the simplest thing. I’ve got a UserPage in my React project. The job is simple, to see and edit values in firebase. Ive got the edit portion working but the read isn’t returning any values. as you can see I’ve got a collection called “users”. Within the co…
Combine variable value and string to use in another variable name
I need to combine a variable value and a string value into one. The problem is in the function. Iam trying to pull the name of a resource in the “resources” variable and this needs to be combine with “Amount” at the end in a new variable called “resourceName”. For example &…