-1

I have this:

z: [[res.push(this.Map.heatmap[0])]],

so this is just one value. But how can I push all the values of the array

and this is the interface:

export interface map { 
    
}

I have a array of 100 values in it:

10

but if I do this:

 this.Map().subscribe((res) => {
      
            zsmooth: 'best'
          }
        ],

not all the values are loaded. So how to load all the values?

and this is how I have the object:

Map: map = {};

Thank you

Oke,

console.log(res)

gives back array with 100 values:


length: 100

but apperently this:

    z: [[res]],

doesn't work. I dont see the value at all.

But if I do this:

hallo: console.log(res.push(this.Map.map[0])),
            z: [[res.push(this.cMap.tmap[0])]],

it returns the number 2

CodeIsNice
  • 31
  • 5
  • thank you but not realy. z: [[res.concat((this.cameraAgretateHeadMap.heatmap))]], doenst work – CodeIsNice Dec 10 '20 at 13:08
  • What I have to fill in for index? – CodeIsNice Dec 10 '20 at 13:08
  • z: [[res.push((this.cameraAgretateHeadMap.heatmap[]))]], – CodeIsNice Dec 10 '20 at 13:09
  • Your edit doesn't make it any more clear to me. "_I have a array of 100 values in it_" Which array? `res`? `this.cameraAgretateHeadMap.heatmap`? `this.cameraAgretateHeadMap.heatmap[0]`? It would really help if you could add what values `res` contains _before_ the push, which values `this.cameraAgretateHeadMap.heatmap` contains and what the expected result should look like. – Ivar Dec 10 '20 at 13:39
  • What you are logging/putting in `z` is the return value of `.push()` (which returns the new length of the array), _not_ the resulting array. You need to first push the elements and _then_ add `res` to your object. – Ivar Dec 10 '20 at 14:27
  • HI Ivar, can you give example – CodeIsNice Dec 10 '20 at 15:01
  • [Like so](https://jsfiddle.net/7pcvh45y/). But that only applies for `.push()`. If you're using `.concat`, then it shouldn't really matter is that _does_ return the new concatenated array. – Ivar Dec 10 '20 at 15:24
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/225782/discussion-between-codeisnice-and-ivar). – CodeIsNice Dec 10 '20 at 15:30
  • can we go to discussion – CodeIsNice Dec 10 '20 at 15:45
  • Are you in chat? I tried that. but page is blanco – CodeIsNice Dec 10 '20 at 16:28

1 Answers1

0

concat function is maybe what you are looking for:

var array1 = [A, B, C];
var array2 = [D, E, F];
var newArray = array1.concat(array2);

The newArray will be [A,B,C,D,E,F] 

In your case you would do something like:

z = z.concat(this.cameraAgretateHeadMap.heatmap)

a little bit more code from your side would have been helpful to understand it in a better what your problem is!

Hopefully this helps!

oezzi
  • 82
  • 4