All Questions
51 questions
1
vote
5
answers
496
views
Find unique array of objects dynamically considering undefined values
I have a an array of objects in this format:
const myArray = [
{
one: 'A',
two: 'AB'
},
{
one: undefined,
two: 'AB'
},
{
one: 'A',
two: 'BC'
},
{
one: undefined,
two: 'CC'
},
]
...
-1
votes
1
answer
266
views
JavaScript add a line break after every 12th character in a string which has HTML tags
I have a string which is a combination of many small strings, wrapped around a HTML tag.
The target is to add a line break after every 12th character excluding the tags.
'<span>This is a text.&...
2
votes
3
answers
145
views
Javascript merging duplicates in an array of objects
I have an array of objects like this-
{"zone":"lobby a","time":"00:00","hub":"I","Sum":0.0,"schedule":"2022&...
0
votes
0
answers
20
views
Lodash return object of array that have true value in object [duplicate]
I have an array of objects, Like for example if I have 4 objects in the array. I just want to return those object which has status: true. Could someone please help me with how to resolve this issue?
...
1
vote
1
answer
788
views
Push object in array when checkbox is checked and remove object when checkbox is unchecked in ReactJS
I am trying to implement a functionality where I want to push object into an array when the user checked it and remove it if the user unselects it. I have a menu where I am collecting user choices. I ...
1
vote
3
answers
209
views
How to update specific object value of an array in javascript
I have an array of objects, I did a map on that array now I want to change specific object values. I used onChange method inside map() function. It not working properly could someone please help me to ...
0
votes
2
answers
1k
views
Proper Way of Searching in React with debounce
I have a problem searching using debounce in lodash. I'm using React, Material Ui and formik.
It says TypeError: Expected a function in
const debounceLoadData = useCallback( debounce(dispatch(...
0
votes
1
answer
533
views
Copy deep nested object but omitting specific key, where key is also an array
There are many many threads similar to this one, but this problem it has an extra difficulty that I could not find a solution so far
I have an object like this:
I would like to deep copy this object ...
1
vote
3
answers
527
views
Merge 2 arrays and their properties based on timestamp
Currently, I have an array containing arrays of TableRowReading, such as let allTableReadings: TableRowReading[][]:
interface TableRowReading {
time: number; // We can think of the timestamp `time` ...
-2
votes
1
answer
98
views
How to move object in same array
I have an array of objects, I want to move any object In the same array. I really tried hard but did not a solution. could someone please help me with how to resolve this issue?
[{name:'user 1'}, {...
0
votes
2
answers
104
views
Simplifying nested array to simple array for plotting Covid-19 timeline
I am developing a Covid-19 dashboard using React.js, please I will like to simplify a nested array from following Disease.sh API call https://disease.sh/v3/covid-19/historical/ng%2C%20za%2C?lastdays=2:...
1
vote
2
answers
170
views
How to remove all next elements from array in javascript or lodash
I have an array of object [{a:1},{a:2},{a:3},{a:4},{a:5}].
I want to find index of {a:3} and remove all next elements from index of {a:3}.
Result should look like [{a:1},{a:2},{a:3}] and removed ...
0
votes
1
answer
322
views
cancel lodash debounce after promise await
I have an input that calls api for results. I kept debounce so that only after particular time api will get invoked. This is working fine. However i want to reset the results after textinput text is ...
0
votes
2
answers
523
views
Javascript check if all values in an object array are empty
I have an array like below.
let report = [
{0: { error1: '', error2: ''}},
{1: { error1: '', error2: ''}}
]
I want to check if all the error values are empty.
Then based on that result I will ...
0
votes
1
answer
75
views
Find key by its index number in an object list and replace with new user input value
Have an object like
{
A: { lists: 2, name: 'John' },
B: { lists: 2, name: 'Tom' },
C: { lists: 1, name: 'Harry' }
}
Here what I want to achieve is select the object key based on its index in ...