All Questions
83 questions
0
votes
3
answers
542
views
How to search string character from an array of objects?
I have an array of objects below. This is the raw data
const data = [
{id:1, sItem:"This is javascript", status:"trending"},
{id:2, sItem:"javascript is fun", status:&...
1
vote
2
answers
58
views
Combine same year items to one object
I have an array of objects that look like this:
[
{
makeYear: 2019,
company: 'Mazda',
fleet: '900'
},
{
makeYear: 2019,
company: 'Mercedes',
fleet: '500'
},
{
...
0
votes
1
answer
45
views
How to Combine Same key JavaScript Object to one Array Dynamically
How to Combine Same key JavaScript Object to one Array Dynamically in JavaScript/Nodejs and Produce given Input to expected output,
Please do help me on this. that would be really helpful.
Example -
[
...
-2
votes
1
answer
68
views
Removing duplicates. generating new one and new key introduced on an array in javascript
I have an array with a certain structure but I'm targetting a particular field value to check for occurrence in other items.
The array looks like this:
arr = [
{'fruit': 'banana', 'code': 3},
...
-4
votes
2
answers
324
views
How to find the longest possible path from an array of objects
im building an api which needs to find the longest path that matches a number in a very performant manner.
eg
// API Request
{
'number': '123456789'
}
// DATA
[
{
'prefix': '1',
'price': 30....
1
vote
3
answers
3k
views
How to get next and previous five element of from an array?
I have an array which consist n element.
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
and also have two button next and prev and initially i am showing the first 5 element(on page ...
2
votes
3
answers
1k
views
Am I using Promise.all correctly?
I am using it many places in my code and it works. but at one place it didn't give any error, also did not give me the desired result. and when I show my code to the support forum they suggest that &...
-1
votes
4
answers
2k
views
How to delete array from array?
There are excellent posts about deleting elements and arrays from arrays, but I can't find any that does it for this situation:
How can I remove the array containing UUID as its first element?
let arr ...
1
vote
3
answers
2k
views
How to loop inside a map() loop?
The below script outputs
================================================
Log entry ID: 1
UUID: 2
Timestamp: 3
--------------------
Log entry ID: 4
UUID: 5
Timestamp: 6
which is what I want.
Right ...
-1
votes
1
answer
46
views
Trying to construct an array from a known map function
I trying to construct a docs array that would work on docs.maps() function below. However when I run it I get
TypeError: Cannot read property 'uuid' of undefined
If I do
console.log(docs[1]['_source']...
1
vote
2
answers
98
views
JavaScript ES6+ compare fields in arrays of objects
Spinning my wheels here. Seems simple conceptually but JS is trying to kill me.
Two arrays of objects:
let allProfileUsers = [
{
id: "0b4cd920-31da-11ec-a31c-cd844bfb73be",
...
-1
votes
2
answers
1k
views
Loop through an array of objects, compare the ids and merge the object
I am looping through an array of objects and trying to get the id and carId of them. I am doing it this way:
getIds(array) {
for (var index in array) {
var combinedIds = array[...
1
vote
3
answers
373
views
JS Javascript - How to put array values in another array by indexes?
I have this array/object:
const template = {0: [0, 1, 2, 3, 4, 5], 1: [0, 1, 2, 3, 4, 6]}
// I have the above but happy to convert the below if it helps:
//const templateArr = [[0, 1, 2, 3, 4, 5],[0, ...
0
votes
1
answer
193
views
Add multiple values to the URL dynamically
I am trying to make a request to an endpoint that expects only one user account Id, so I tried to separate the user account Ids (if they are multiple) by &. The this.account is an array with ...
-1
votes
3
answers
79
views
Creating index in JS array
I am generating a mysql query and the result is showing like this.
[
{
"brand": "Brand 1",
"channel": "TLP Channel",
"memo": 449
},
{
"brand&...