Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript Pull/Push Single/Multiple

i'm currently learning RxJS.

inside the doc, i find this array. enter image description here

i try to search "pull and push javascript" on google but i don't even know how to call those entity/concept. i can't figure it out what that means ? i assume Single / Multiple is about the value returned but my question is about the difference between Pull and Push ?

Can you bring me the light ?

like image 668
Leeroy_Wonkledge Avatar asked Feb 03 '18 21:02

Leeroy_Wonkledge


People also ask

Can I push multiple Values in array JavaScript?

There are multiple ways to add multiple objects to a single array list in JavaScript. We can use the functions like push() and splice() which directly append or add one or more objects to the existing single array list and we can use the spread operator.

How to push multiple objects in an array?

To add multiple objects to an array, you can pass multiple objects as arguments to the push() method, which will add all of the items to the end of the array.

Can you push an array into an array JavaScript?

push. apply(newArray, dataArray2); As "push" takes a variable number of arguments, you can use the apply method of the push function to push all of the elements of another array. It constructs a call to push using its first argument ("newArray" here) as "this" and the elements of the array as the remaining arguments.


1 Answers

Pull: returning a value.

  • Single: functions return a single value on use.
  • Multiple: Iterators return multiple values and are more like a stream of data

Push: sending an event with a value to its listeners

  • Single: promises trigger its own event listeners with a value once
  • Multiple: Observables(what is added in this docs page) trigger any subscribed event listeners with new data any time it is called

I don’t actually use RXJS but if you’re unsure about how these 4 things work read Kyle Simpsons You Dont Know JS book on async.

I hope I brought you the light.

like image 130
James Apple Avatar answered Sep 27 '22 15:09

James Apple