Linked Questions
51 questions linked to/from Zip arrays in JavaScript?
2
votes
1
answer
3k
views
Combine two arrays as pairs [duplicate]
I have two arrays that I'd like to combine, but in my searching I've only been able to find Array.concat.
let a = [1,2,3,4,5]
let b = [6,7,8,9,10]
How do I combine these to create the following?
let ...
1
vote
3
answers
2k
views
Map an array to create a new array of pairs [duplicate]
I have two separate arrays and I'm trying to create a new nested array that has values grouped together.
Can I use the map() method and pair each item inside the map method?
There is a similar ...
0
votes
2
answers
2k
views
Merge elements of two 1D arrays as elements of a 2D array using JavaScript [duplicate]
Is it possible to merge (or maybe convert?) two large 1D arrays (of tens of thousands of items) into one 2D array so that columns of 2D array are the element wise items from each of the 1D array?
I ...
0
votes
1
answer
379
views
how to combine two arrays into multiple rows in javascript? [duplicate]
I have two arrays
array1=[1,2,3]
array2=['one','two','three']
I want the result to be
res=[[1,'one'],[2,'two'],[3,'three']]
[end of problem] The below line was added just to meet the question ...
0
votes
1
answer
487
views
Typescript - Multi list map() function [duplicate]
Is there a function similar to map() that can take more then one array as input.
I am talking about something like this:
arr1 = [0,1,2];
arr2 = [2,4,6];
result = [arr1, arr2].multiMap((item1, ...
0
votes
0
answers
182
views
Adding key value pairs from two arrays to mongoDB using insertOne nodejs [duplicate]
I have two arrays, one contain keys and other the values. I want to insert key value pairs in mongodb.
var keys = ["item1","item2","item3"];
var values = ["15","14","19"];
I am using insertOne to ...
0
votes
1
answer
88
views
Combine two array and make a separate array [duplicate]
I have two arrays namely a and b. I want to combine first value of a and first value of b as one array and that continues. (i.e)
a = ["05:25 PM", "3:05 PM"];
b = [60, 120];
Desired Output:
['05:25 ...
0
votes
2
answers
59
views
How do I take two separate arrays and combine them into one array of objects? [duplicate]
I have two arrays. One contains a series of dates. The other array contains a series of data. What is the best way to combine the two arrays into one array of objects.
As an example the first element ...
1
vote
2
answers
55
views
Systematacally combining arrays [duplicate]
so i have these three arrays:
var a = ["one", "two", "three"];
var b = ["a", "b", "c"];
var c = ["1", "2", "...
1
vote
1
answer
58
views
Merge 2 arrays in change [duplicate]
I wanted to merge two arrays like you can fold 2 packs of cards - in ugly code with for loop and assuming same length so no if's for safety it would look like this:
const arr = [1,2,3];
const rra = [...
0
votes
1
answer
67
views
Javascript multidimensional array key - val [duplicate]
In my javascript function i have two single array like this:
var row = ["var1","var2","var3"];
var col = ["res1","res2","res3"];
i would create a multidimensional array like:
[["var1","res1"],["...
0
votes
2
answers
57
views
How to combine first element of one array with first element of second array and second with second and so on [duplicate]
I am having two arrays,
the first array contains:
1, 2, 3, 4, 5
and the second one contains:
100, 200, 300, 400, 500
the result should be:
[ [ '1', '100' ],
[ '2', '200' ],
[ '3', '300' ],
[ '...
0
votes
1
answer
54
views
traversing a multiarray with Javascript [duplicate]
Hi guys I have this array :
[[2,3,0],[0,4,5]]
and i want traverse this array like:
[[2,0],
[3,4],
[0,5]]
Any recommendations please? I am working with javascript
-1
votes
1
answer
56
views
Get one new array of objects from two arrays [duplicate]
I have an array of objects. Here is the array:
arr = [
{
"id": 0,
"name": John,
},
{
"id": 1,
"name": Kim,
},
...
-10
votes
2
answers
76
views
javascript join array to another [duplicate]
I want to write a function to join an array to another but different way :
var myNumbers = [10,20,3,4,2]
var myOperations = ['+','-','*','/']
I want the operators locate between myNumbers element :
...