Reactive Paradigm

  • Iterator: Sequentially access the elements of a collection without knowing the inner workings of the collection.1

  • Observer: A way of notifying change to a number of classes to ensure consistency between the classes.2

Iterator

//ES 6

var iterator = ["apple", "oranges", "banana"];        
<-:undefined   

var fruits = iterator[Symbol.iterator]();
<:-undefined

> fruits.next()
<:-{value: "apple", done: false}

> fruits.next()
<:-{value: "oranges", done: false}

>fruits.next()
<:-{value: "banana", done: false}

>fruits.next()
<:-{value: undefined, done: true}
1. _ Iterator: 2: _Observe: link

results matching ""

    No results matching ""