All Questions
2,768
questions
-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 ...
-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'...
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, ...
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 ...
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 ...
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",
...
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",
...
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: ...
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:...
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>
<...
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 ...
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 ...
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: "...
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 ...
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" ...