Category "arrays"

Return complete array from Promise

I have a function that returns JSON objects using hnews.getById(id). I then push each story returned in the promise to an array. I'm having trouble figuring out

Using "in" to check whether a string occurs in an array [duplicate]

In Javascript is it possible to check whether a string occurs in an array by using the "in" operator? For eg: var moveAnims = new Arra

Dynamically initialize array size in go

I try to write a small application in go that takes 'x' numbers of integers from standard input, calculates the mean and gives it back. I have only gotten so fa

Rotation of the array means that each element is shifted right by one index, and the last element of the array is also moved to the first place

For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7]. The goal is to rotate array A K times; that is, each element of A will be shifted to

Rotation of the array means that each element is shifted right by one index, and the last element of the array is also moved to the first place

For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7]. The goal is to rotate array A K times; that is, each element of A will be shifted to

Check If array is null or not in php

I have an array like below which is generated by parsing a xml url. The array is Array ( [Tags] => SimpleXMLElement Object ( [0] =>

Is there a multivalued field type available in PostgreSQL?

I want to know if it is possible to store multiple values in a field in PostgreSQL. I have a table called Token with the columns id, text and category. categor

DISTINCT result of ARRAY_CONCAT_AGG in BigQuery

I need to compute distinct set of items from the aggregated arrays. I cannot use the array_concat as suggested in similar threads, as I don't know how many arra

ROS2: how to create an Int8MultiArray

This is a ROS2 beginner question I've tried to use several ROS sources which suggested me to include "std_msgs/Int8MultiArray.h". However, if I do that I will g

Find missing day from array of dates javascript

I am getting an array of day dates from an API: 0:{date: "2016-11-17T00:00:00",…} 1:{date: "2016-11-18T00:00:00",…} 2:{date: "2016-11-19T00:00:00

json_encode turns array into an object

I am have created a 'liking' system for a site but I'm having a bit of trouble with json_encode and json_decode. I use arrays to store who has liked a post, so

Copy array by value

When copying an array in JavaScript to another array: var arr1 = ['a','b','c']; var arr2 = arr1; arr2.push('d'); //Now, arr1 = ['a','b','c','d'] I realized

Copy array by value

When copying an array in JavaScript to another array: var arr1 = ['a','b','c']; var arr2 = arr1; arr2.push('d'); //Now, arr1 = ['a','b','c','d'] I realized

REACT- Uncaught TypeError: Found non-callable @@iterator

In react, I have a component that takes in 2 destructured parameters. One of them is an array called points. However, when attempting to call the Math.max(...po

Why does the indexing start with zero in 'C'?

Why does the indexing in an array start with zero in C and not with 1?

How can I use `defineProperty` to create a readonly array property?

I have the following as a part of a module (names simplified for purpose of question): In "module.js": var _arr; _arr = []; function ClassName () { var

Retrieving values from multidimensional arrays

I have an array something like this: int[,] multiDimensionalArray2 = { { 1, 2 }, { 4, 5 } }; if I want to retrieve 1 and 2 and feed them into this: int a; i

storing coordinates in array in javascript

I want to store coordinates into an array in javascript, I am new to javascript and do not have an idea how to do it. Any help would be appreciated.

ES6 - Finding data in nested arrays

In ES6 using find or filter I'm quite comfortable iterating through to find an element in an array using a value. However, I'm trying to get a value from a par

how to combine many google sheets in one sheet by using query

I created two online sheets and tried to collect them in another one sheet by query but there a missing data although it's exists in the original sheets (data s