Skip to main content

All Questions

Tagged with
0 votes
1 answer
29 views

Creating and populating elements for each object in array, with respective object data

I am trying to create a list of values from a sorted array that will automatically generate a DOM element for each unique object inside of the sorted array. I have a JSFiddle here since it requires ...
Apricosma's user avatar
0 votes
0 answers
110 views

How to get window object output in console using 'this' keyword in standalone function call

I want to check how 'this' keyword is behaving in Javascript ES6. To perform this I wrote code snippets to check output of 'this' keyword in object and also normal standalone function. When I call the ...
Dulanjali Senarathna's user avatar
-5 votes
2 answers
127 views

Group all the values of common keys as an array in array of objects [duplicate]

I have an array of objects as const arr = [ { "id": 2, "key": "cc_edit" }, { "id": 4, ...
n3018's user avatar
  • 131
0 votes
1 answer
321 views

Apply child value to parent key if specific key exists in child in object

const obj = { uid: "893212", a: {name: "Down here!", uid: "1231"}, b: { c: {uid: "5965"}, name: "bud name", }, d: {name: "...
kiranbabu's user avatar
  • 117
1 vote
2 answers
107 views

JS/lodash - Can we efficiently change an 'array of Object' having value 'Array of Object' into array of Object with single array values

I have used lodash to create chunks of arrays (batches). let values = { 'key1' : [lotsOfValues1], 'key2' : [lotsOfValues2] }; let keys = ['key1', 'key2']; let arrObj = []; keys.forEach((key) =&...
mishraak's user avatar
2 votes
4 answers
153 views

Is there a ES6 shortcut way to compare array of elements and object key and remove the non-matching elements?

I am trying to find a shortcut or single line of code that can active following: I have a array selectedFields consisting of elements: selectedFields = [ "time", "age", "city&...
BATMAN_2008's user avatar
  • 3,310
0 votes
1 answer
122 views

Invalid left-hand side in assignment expression for deep nested object in react

I have a reactjs project in which there is a useState variable which is very nested. Something like this: { chart: { type: 'bar', height: 430 }, plotOptions: { bar: { ...
Rishab Raghwendra's user avatar
0 votes
3 answers
90 views

Remove some array object comparing with another array JavaScript

I have two dynamic array. One is Array of objects and another one is array of some string. First Array is : const initialColumns = [ {content: "Registered Name", id: "name"}, { ...
Asadul Rahman's user avatar
0 votes
0 answers
14 views

Why am I allowed to use variable as property name in javascript object creation without using ES6 bracket notation? [duplicate]

Consider the following example var x = 1; var obj = {y:1, x}; console.log(obj, obj.x); I have tried to find many stackoverflow posts and MDN documentations, but I fail to find any reference ...
user31782's user avatar
  • 7,453
0 votes
1 answer
127 views

Assigning values to arrays with dynamic keys in nested objects in javascript

I have problems understanding and creating dynamic keys of an object and assigning values to nested objects. desired output: { SULS: { "Main Site": ["Home Page", "Login Page&...
Piggyinu's user avatar
1 vote
4 answers
267 views

turn a flat array into cell like objects for a grid

I have an array that looks like similar to this, [ ['column1', 'column2', 'column3', 'column4', 'column5'], ['2column1', '2column2', '2column3', '2column4', '2column5'] ] I wanting to turn ...
Udders's user avatar
  • 6,936
0 votes
1 answer
39 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 - [ ...
Krishna Gupta's user avatar
0 votes
2 answers
471 views

How to get object value if key is not string but you are given string key to find value

How to get value of Object if its key is not string but you are given a string to find value Example: let obj={ arr: ["Kapil"]}; find value of obj.arr is you are given '...
Elon Musk On Stackoverflow's user avatar
0 votes
0 answers
17 views

How to create a copy of array without modifying it old value? [duplicate]

I have two arrays tasks and updatedTasks. When the first api call is made, one of the properties is updated. When I make a copy of tasks array and make a second API to update other property, it adds ...
parthc's user avatar
  • 65
-6 votes
1 answer
60 views

Is there a way to convert an array of arrays to JSON? [closed]

let letter = ["a", "b", "c"]; let number = [1, 2, 3]; let arrays = [letter, number] // What code will achieve the following result? let result = [ { letter: &...
Trevor's user avatar
  • 1

15 30 50 per page
1 2
3
4 5
73