Category "arrays"

Push unique objects into array in JAVASCRIPT

I want to push object that only have unique id1 into array. Example: let array = [], obj = {}, access = true if(access){ obj['id1'] = 1 obj['id

How to define Typescript Map of key value pair. where key is a number and value is an array of objects

In my angular2 app i want to create a map which takes a number as key and returns an array of objects. I am currently implementing in following way but no luck.

Sort a multidimensional array by integer inside of a string value which is two levels down

I have a multidimensional array in php: Array ( [0] => Array ( [certificate_name] => track.site [domains] => track.site

How to render API data into React Frontend using functional components?

I have successfully created a backend API using Node+Express+MSSQL and tested out the routes using POSTMAN. Now the challenging part is when I try to render the

Swift: What's the best way to pair up elements of an Array

I came across a problem that required iterating over an array in pairs. What's the best way to do this? Or, as an alternative, what's the best way of transformi

How can I group an array of objects by key?

Does anyone know of a way (lodash if possible too) to group an array of objects by an object key then create a new array of objects based on the grouping? For e

Google Spreadsheet MAX + Join of other cells

I have a spreadsheet like this - I can't figure out how to dynamically search for this. I want to find the MAX Score Value + output the related name (no worries

Show rotation of tweets using current day of month

I'm trying to create something that will check the date and produce a different variable result depending on the date today. This is my current code: <?php

Accessing values inside Objects

I am trying to print a 2d array of a schedule that is inputted to me via object. When it prints, it is not giving me the values I want. Any idea what i doing wr

Calculating Median of an array in PHP

I'm trying to figure out how to calculate the median of an array of randomly generated numbers. I have the array all set up, but I'm having trouble putting toge

How to group array or column based data by a specific item's/column's value while summing-up the values of another?

We are building an integration in a SAAS product which exports data from a table and writes it to a CSV file. Tool allows JavaScript (Which i am not very famili

Nested if statements vs &&(or) operator

I've been trying to solve this https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/profile-lookup/ with the following code

Multiply each value in array using array_map function

I'm trying to multiply each value from array_module_rate array. The result should be: $array_module_rate[0] = 25 $array_module_rate[1] = 15 $array_module_rate

Sum column values from multiple arrays

I have an arrays with dynamic name. My array could be more than 3, depends and array variable should be unique $loopThrice = 3; $getSum = 0; $total = array();

Sort HTML elements by data-attribute [duplicate]

I have the following markup: <ul> <li class="category-item" data-category-group="jeans">Bottoms</li> <li class="cate

How to declare string array[] of unknown size (JAVA)

I want my String[] array; to be static but I still don't know it's size. Is there any way to declare string array of unknown size? As much as possible I don't

Json_Encode not returning html even i try to encode JSON_HEX_QUOT | JSON_HEX_TAG

I want to return HTML from PHP. I found a solution from StackOverflow which is insert JSON_HEX_QUOT | JSON_HEX_TAG after array in json_encode but it does not wo

How to get max values for each unique value in a different column in Google Sheets?

I have two columns, the first column (A) has names and the second column (B) has values. A B apple 10 orange 12 orange 14 apple 8 Is there a way to get only r

How to append a tuple to a numpy array without it being preformed element-wise?

If I try x = np.append(x, (2,3)) the tuple (2,3) does not get appended to the end of the array, rather 2 and 3 get appended individually, even if I originall

Distribute array row data to make multiple new rows

I have below the data [ { "price_in_dollar": 1000, "price_in_euro": 1000, "price_in_pound": 1000, "price_in_rupee": 1000,