I have an object with a lot of properties, lets say: I want to separate a group of properties as follow: What i am doing is: is this the only way to achive this? is there a way to ignore properties that are undefined? For example let say h is undefined, so ideally obj2 would only be obj2={a,w} It is
WeakMap with event.target
Edit: turns out nothing is actually wrong with the second snippet (my real code). On one page it works, and on another it doesn’t. Yea for underlying errors. I’m creating a DOM element and giving that DOM element to a WeakMap as a key. Then, with JQuery event delegation/event listener, I’m t…
Reduce throws “NaN” in JavaScript?
I am trying to sum items in array. While searching Google and Stack Overflow I found that reduce is a good way of summing an array items. But, when there isn’t any key value pair reduce throws error as “Nah”, so how to deal with it? My array exam: So from above, I need to calculate all the k…
Node JS Dialogflow error :INVALID_ARGUMENT: Input text not set.?
I encountered the following error while sending POST request to the Node JS code. There was a similar but unanswered 2 years old question in stackoverflow. So I decided to ask. My code: Error i received: POST request : Answer Found the answer I had missed the header. It was solved after adding the POST header…
useState not working with Array of Objects
So I am working with React Hooks and with an array of names which will have buttons. On clicking those buttons the corresponding name would disappear. But the array is not updating at all. Please advise what can be done, I’m a newbie in React. Thank you! Answer You are using your data variable which nev…
Why my props action doesn’t work in an “if” statement in “onClick”, but it works outside the “if” statement?
This code works: This code doesn’t work: I’m new to reactjs Does any body know why it doesn’t work in the second way? Answer Just a tip; Make a function and then call the funciton onClick instead. The code gets simpler to read!
Fire only one button in buttons list using jQuery
I’m struggling trying to figure out a weird issue. I have a table with several rows, each row has a column with action buttons, the code to draw the buttons group is the following: If user click on edit buton I want to start a Javascript ( jQuery) function, otherwise I start the remove function. Below t…
Need for modification of the javascript countdown code
Please i have a JavaScript countdown timer code that i got from stackoverflow that is a solution to my countdown timer project. this existing code counts down time from 30minutes down to 1 and start over again. and it gives the same count result to every user at the same time. But my challenge with the code i…
How can I set Date in second TextBox to first TextBox’s day + 1
I have two TextBox in a page. When user pick a date from first TextBox, second TextBox has to be first TextBox’s day +1(previus dates has to be disable). For exemple: User pick 2020-12-29, second minimum date has to be 2020-12-30. Here is the first TextBox with js codes that sets the date to today. I ca…
Firebase extract name of object
I have a simple question today. I retrieve data from my firebase database: Also I log the results in the console, the following text is what I retrieve: Now my question: I want to access not the id that is in the objects but rather the “name” of the object itself. If you look at the first element:…