(NOTE: This question isn’t the same as the similar one above, as it is about differences between attached and detached DOM trees.) A simple bit of HTML containing a DIV with no whitespace between its elements: I output innerText to the console three times. The first time is that of the original DIV: The…
Category: Questions
How to do CRUD operations on a firestore DB from a cloud function? (Node.js)
I use a cloud function as a webhook receiver, so every time I get a webhook I want to update firestore with some data for example. I don’t get how to use firestore in my clound function. I tried this: All do not seem to be able to initilise this. I also tried: Answer As explained in the documentation, t…
Change the output data in a VueJS multiselect
This is a VueJS multiselect html output. It pulls the data from a JSON file via axios. I cannot change the data. I would like to be able to amend the text if possible and hide the blank entry. So instead of ‘BL’, I would like it to display ‘Black’ and instead of ‘BLK’, I wo…
Calculate Percentage of each key in Object
So I have this data, how can I compute their respective percentages? Thank you Answer A simple reference for you by using reduce()
Set timeout function not slowing down
I am trying to create a loading screen and have different sets of text show up while it’s loading, but when I increase the rate to 5 secs, the function skips to the last set of loading screen text and doesn’t show the other sets. How can I solve this issue? JS: Answer There are two issues in your …
MUI + React Hook Form: Fill out TextField value but then can’t modify the value
I’m using the combination of MUI + React Hook Form, so I’ve created a CustomTextField.tsx component to make it worked. Then at the app/parent level, I want to these steps: Fetch data and display to the TextField. Modify the text in TextField Submit the new value in TextField This is my approach: W…
How to convert flat data structure to tree structure in JavaScript using recursion
I want to create a tree from the data provided using recursion. I am also trying to get the tree to pass an npm test, but when I run the test, it is failing. I am getting a tree, but it looks different than the one it is supposed to look like. Here is the code (with instructions in a
JavaScript – this keyword inside an object method
I’m expecting to see the value of 26 returned to the console based on the following code snippet, but I get ‘undefined’. Have I used the ‘this’ keyword incorrectly? Answer I change your code a little bit. it should be work now. when you call the function you must need to use func…
it’s possible to obtain the data stored in a label label to assign it to another variable and thus be able to graph it?
my label Porcentaje: here I am adding the result of my operation to the label document.getElementById(“percentage1”).innerHTML = perc1 + “%”; I am trying to assign it to another variable the value of the label let PorcElement6 = document.getElementById(“percentage1”).label;…
Having a problem with starting a setTimer for a function and stopping it JavaScript
Hello I want to make it so that I can start and stop a function with a keypress and I’ve been having a problem with setting a timer on my function and I don’t know why the addEventListener is giving me errors like this is not a function or window not defined I tried to switch window with global be…