Linked Questions

8 votes
5 answers
8k views

I have this data var foo = ['US','MX','NZ']; var foo1 = [12',13',17]; var Object = {}; Ive tried this thing var Object = {foo:foo1} but it is not working when i arrayed the object using alert (...
GGw's user avatar
  • 443
6 votes
4 answers
7k views

How can I create an object from two arrays without using loops in JavaScript. example: array1 = [ 1, 2, 3, 4, 5 ]; array2 = [ 'A', 'B', 'C', 'D', 'E' ]; I want from below object obj = { '1': 'A', ...
3nath's user avatar
  • 223
1 vote
1 answer
74 views

I have two arrays with the same length. array1 = ['title', 'details', 'price', 'discount']; array2 = ['product name', 'product details', 200, 20]; Want to convert them into one object like following ...
Jahid's user avatar
  • 19
0 votes
1 answer
169 views

Having two arrays: let values = ["52", "71", "3", "45", "20", "12", "634", "21"]; let names = ["apple", "...
big_OS's user avatar
  • 451
0 votes
2 answers
87 views

I've been facing issues in making array of objects using array and array of arrays. In my scenario I'm having 400 cols and 5000 rows. Having col names in separate array and user data in array of ...
Vignesh RaviKumar's user avatar
-2 votes
1 answer
73 views

consider i have an array say let arr1=["john","Bruce","Clent"]; and let arr2=[55,33,22]; Then how can i make an object out of this in javascript object should look like:{&...
NoushadM's user avatar
  • 121
0 votes
1 answer
16 views

I have the following structure and I would like to change keys name from this let FIELDS = ['id', 'first_name', 'last_name', 'email'] let {...obj} = ['123','John','Doe', null] console.log(obj) // {0: ...
Markus Hayner's user avatar
86 votes
21 answers
167k views

Situation: I have a large object containing multiple sub and sub-sub objects, with properties containing multiple datatypes. For our purposes, this object looks something like this: var object = { ...
Jake's user avatar
  • 4,264
62 votes
14 answers
51k views

I have: var keys = [ "height", "width" ]; var values = [ "12px", "24px" ]; And I'd like to convert it into this object: { height: "12px", width: "24px" } In Python, there's the simple idiom dict(zip(...
itsadok's user avatar
  • 29.5k
0 votes
7 answers
15k views

I have two arrays, keys and commonkeys. I want to create a key-value pair using these two arrays and the output should be like langKeys. How to do that? This is array one: var keys=['en_US','...
user avatar
3 votes
2 answers
9k views

needing some advice on how to do this properly recursively. Basically what I'm doing, is entering in a bunch of text and it returns it as JSON. For example: The text: q b name:rawr Returns: [ "...
Menztrual's user avatar
  • 41.7k
1 vote
3 answers
2k views

I have 2 arrays that i want to "reduce" into 1 object. so for instance: I have.. var originalData = [1,2,3]; var newData = [3,1,2]; i want to combine these two arrays into an object that looks ...
zomdar's user avatar
  • 273
1 vote
3 answers
835 views

* def alphabets = ["a","b","c"] * def number = ["1","2","3"] So that the final mapped result should be final =[{"a":"1"}...
Ninja's user avatar
  • 453
4 votes
3 answers
282 views

I've got some headers and peopleData: const headers = ["name", "age", "nationality"] const peopleData = [ ["John", 31, "Spanish"], ["Jane&...
SixtyEight's user avatar
  • 2,490
0 votes
5 answers
958 views

I've got two arrays of strings of equal length, and I want to make a key:pair object out of them, like: INPUT: let words1 = ["foo", "loo", "who"]; let words2 = ["bar&...
Nate's user avatar
  • 65

15 30 50 per page