Skip to main content

All Questions

Tagged with
-8 votes
0 answers
28 views

How to get and sort a string from an array in javascript? [closed]

I have this array with this string: ['MEX-CUN'] ['MEX-MTY'] and I would like a result similar to this: CUNMEX MEXMTY Is it possible to perform this action?
dany952's user avatar
  • 303
0 votes
1 answer
32 views

Find the average per index in a matrix

I'm looking to get the average of each index in a matrix row in JS [1, 2, 3] [4, 5, 6] [7, 8, 9] Then returning a list with the average of each row index : [4, 5, 6] Would I create a loop, save each ...
zaklance's user avatar
1 vote
0 answers
36 views

Multiple adding to cart in JavaScript doesn't work

when I add products to the shopping cart at some point it stops updating the table, it is refreshed when I click the previous product and the product I want to add. Live site: https://frontend-mentor-...
Kajetan Ślęga's user avatar
-1 votes
3 answers
72 views

Todo list using array and loop

I want to create a todo list using array and loop and display the list in div container. I am able to display the list but it is muliplying the same list stored and is displayed. <body> <...
Sam Sandy's user avatar
-1 votes
0 answers
17 views

How can I convert a multidimensional array from x by y to y by x? [duplicate]

Given the 3x2 multidimensional array: const arr = [ [1, 3, 5], [2, 4, 6] ] where (1,2) === 2 and where (3,1) === 5 and etc How can I convert it to the 2x3 multidimensional array: const arr = [ [...
danday74's user avatar
  • 55.4k
-1 votes
3 answers
42 views

Retrieve array data that every nested array contains

The main goal is to select all the colors that every car.colors contain, if there's no color that every car have then the expected output is an empty array. Having an array that contains text, and a ...
mynameiszsofia's user avatar
0 votes
0 answers
13 views

Google Earth Engine: error "Invalid type. Expected type: Number" trying to compute a Number while performing histogram matching on satellite images

I am working on satellite imagery on Google Earth Engine (JavaScript), and I'm experiencing some issues while I try to perform histogram matching on two images from two different time periods. In ...
Aurora Bozzini's user avatar
0 votes
0 answers
38 views

Leetcode output is different from visual studio code output

I just started on my leetcode exercises and I ran into a bit of a problem. I usually work on the leetcode problems on vsc and then when I got my answer, i just copaste it onto the leetcode answer box. ...
Andrey's user avatar
  • 3
-1 votes
1 answer
42 views

Javascript: How to compare a parent array of array with more than two similar elements of another array and return unique array of arrays

const array1 = [[1, 2, 3], [1,3,4], [1,2,5]]; let b = [] let c = [2,3] array1.forEach(e => { c.some(r => { if(e.includes(r)) b.push(e) }) }) console.log(b) got the ...
sharath222's user avatar
0 votes
1 answer
21 views

useState returning empty array on default state, using react + supabase

I need help to understand why when I console.log(menus) on Menu.jsx it returns an array of values, but if I console.log(item) it only returns an empty array, while the default value of the item is &...
eko pram's user avatar
1 vote
1 answer
38 views

How to stop the second console.log from including the array of the first in its calculations?

I made a function that will find the sum of whatever array you put in. The problem is that if I have 2 of these console.log up, the second will add the sum of the first to it's result. What am I doing ...
Issac Alleyne's user avatar
0 votes
0 answers
26 views

How do get search filter data in es6

// Filter rows based on string values and exclude from whiteList const whiteList = rows.map(sel => sel.RuleAutoID); // Array of IDs to exclude console.log('whiteList', whiteList); // Assuming you'...
user1931511's user avatar
-1 votes
2 answers
33 views

Extracting values from array and adding them to new elements

I've got some code which loops through an array of products, it records new categories found and also how many times a category is found: const categoriesFound = (catArray) => { let categories = {...
Chobbit's user avatar
  • 493
3 votes
2 answers
61 views

Traverse over tree type structured data uing JavaScript

I have a data set having parent and nested children in it. The purpose of this data is to traverse over parent to -> child1 to-> Child1Child ..... -> child2 to -> child1 to -> child2 ...
vikas dhiman's user avatar
2 votes
1 answer
53 views

javascript setting a .map() range and update the range later

I'm building an app with React & JS which returns products from a json list inside a component, the array is outputted on the app using a .map() array. I'm also limiting the amount to return ...
Chobbit's user avatar
  • 493

15 30 50 per page
1
2 3 4 5
6209