Skip to main content

All Questions

Tagged with
-2 votes
2 answers
42 views

I want to return a key using Lodash when it contains a particular value

I have an object like this: const obj = { 'MONEY-OUT': { USD: ['a', 'b', 'c'], EUR: ['d', 'e', 'f'], }, 'MONEY-IN': { USD: ['g', 'h', 'i'], EUR: ['j', 'k', 'l'], }, }; and I ...
testerJuan's user avatar
-1 votes
2 answers
44 views

keep getting TypeError: array.push is not a function when trying to push an object into an existing array with objects

I'm learning about localStorage and I'm trying to build a basic shopping cart function. The process is: user clicks on "Add To Cart" button. If localStorage("shoppingCart") doesn'...
Lexiriam's user avatar
0 votes
4 answers
66 views

Loop through array of objects, sum array elements and put result in last element

I have an array of objects as follows. Each object has an array P2 inside it. let input = [ { "P2": [ 6, 6, 0 ] }, { "P2": [ 3, 2, 0 ] }, { "P2": [ 5, 1, ...
Aren Trot's user avatar
  • 473
0 votes
1 answer
38 views

I have been trying to upload a file to an api but getting this error Objects are not valid as a React child, use an array instead

I have been trying to submit a file to my API but I am getting this: Objects are not valid as a React child. If you meant to render a collection of children, use an array instead. Below is my code ...
Harshdeep Singh's user avatar
2 votes
3 answers
90 views

Find objects of a certain length inside the object

I need to go through the json object and find keys-objects, keys-arrays whose size matches a given value. I can't understand where to set the conditions. function traverse(obj, size) { for (let ...
Alexander Wang's user avatar
0 votes
0 answers
15 views

Create a tree array using string id in javascript [duplicate]

I have an array of comment and its replies as follows: [ { id:"comment 1", data: "data1", parent: "comment 0" }, { id:"comment 2", data: "data2", ...
VX7's user avatar
  • 23
0 votes
2 answers
93 views

Access inner keys in json data in typescript

I have this following object { "Monday": [ { "morning": [ { "start_time": "02:00", ...
user3653474's user avatar
  • 3,709
0 votes
1 answer
90 views

use a value instead of an index in array object

I can't seem to format my array that is being saved to localStorage. Can you change the index value of an array? I have an array object like this: const myArray = [{id: 41, name: "x"}, {id: ...
artworkjpm's user avatar
  • 1,317
0 votes
1 answer
75 views

Append new keys to a JSON array

I have this JSON array that Zabbix retrieves as a string and each object has the keys "startTime" and "endTime" which are date-time strings in the format of "DD-MM-YYYY HH:mm:...
markfree's user avatar
  • 183
0 votes
1 answer
48 views

How can I return matching query from array of objects?

I have an array of JSON objects to be output, where if the user enters an input the system will return the matching records, looking at name, mobileNumber, hobbies and gender. <template> <...
red17's user avatar
  • 77
0 votes
0 answers
16 views

My data from axios doesn't save in my global variable [duplicate]

I just wrote a function to fetch users from "reqres.in" with axios. I just cant save the data in my global variable but in the function with console.log everything is fine! This is my code ...
Hoomaan's user avatar
  • 21
0 votes
1 answer
94 views

How can I make new arrays for each respective element inside of my object which consists of four arrays total to dynamically generate a week forecast?

I am back again! I am almost done with the same project from which my most recent question is also derived. I have hit a huge bump in the road. Pretty much, I am trying to make a 7 day forecast ...
vaahtlnirn1's user avatar
0 votes
4 answers
57 views

Advanced Filter array of objects based on condition if its nested object has required property in it

I am trying to solve a difficult computation but i am not reaching anywhere. can someone please help Here is a simple example. const filterCityBy = "NY"; const data = [ { name: "...
Aren Trot's user avatar
  • 473
0 votes
0 answers
23 views

How to loop through an object's keys and access information from each seperately [duplicate]

Each product key is nested with more objects. I can't seem to get an idea of how to get information from each product seperately. The code below shows what i'm trying to do. I know that it doesn't ...
Robinski's user avatar
1 vote
0 answers
40 views

I want to display from date and to date on the frontend container from the json data

I have 4-5 containers in my html. Refer the sample code below. <div class="mainContainer"> <div class="subContainer"> <%--<button id="testdata" ...
Ashley Ferns's user avatar

15 30 50 per page
1
2 3 4 5
185