I have a string like this: I expect to loop until end and read the id and text one by one, how to do this in javascript? I have tried below: Answer Your JavaScript is invalid. Make sure to wrap it in single quotes.
Get the average of rates per assignment
I have the following data: Now I need to calculate the average difficulty and fun rates per assignment. As you can see, not every student has the same assignments. What approach is the best when starting blanco. .map()? Or better for (var i = 0; i < assignments.length; i++){//do something} methode? I assum…
Remove array objects contained in another array by value
I have to remove all the objects from array that contain the same id present in another array. This code works but I’m looking for a more elegant way to do it. I’ve tried also but doesn’t works. (it creates a new array, but at least one item with the same id remains in the new array). Is the…
How to clean input fields after another operations in a function in React?
I have a button and 2 input field and I am sending these input field values to backend. etc doing some operations. After doing operations in addCustomer function, I want to reset input fields but it is not working. Here is the code: Here everything is working good except they are not resetting or setting to a…
Why does my React app disappear when I run it
Whenever I get data on my page, after a few seconds, my whole react app disappears as in the root div in the html is left completely empty like this <div id=”root”></div> as if there is nothing. This is happening on all my other projects too even when I create a new one, this disappear…
How to number specific array items if they meet specific condition in Vue JS?
Let’s say I have an array of objects like below in my vue state: On my web page, all these names are already displaying in a list. What I want to display on my web page is like below: Daniel Ross – Default 1 Rachel Joey Monica – Default 2 Gunther – Default 3 From example above, I think…
Using maps over template literals
so I need to print a boolean value if the given string contains [[placeholder:var3]] but the var3 will be dynamically fed from an array as belwo: I tried using map around the template literals but it is throwing me an error also tried like above eg but it checks only first value of the array, so can someone p…
CommonJS I Can’t uncheck the Checkbox
I’ve tried to autoscroll my div but I wanted to add a checkbox to users can select this event (scroll or not) I used If statement but doesn’t work, if it is one time checked, always return my function to autoscroll my chat window. here is my code Answer
Error: animal.image.map is not a function
I am currently making a shelter web app using mern stack and i am struggling to display an image from my object. i already used the map but i think it is only for array objects. so i am clueless how to get the images.url on my animal object. this is my animalSchema AnimalReducer and this is what i use
Cannot destructure property ‘chat’ of ‘_ref’ as it is undefined (firebase & react)
I have this code that runs to fetch data from a firebase collection: Basically I am fetching all the docs of collection ‘chatLists’ and seeing if an array called “users” which has two users includes the current users name who’s using the app, if they do, I return them all and all…