mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
Fix coding style in docs/iterator.md
This commit is contained in:
parent
307932e155
commit
3c84554957
@ -37,7 +37,7 @@ function makeIterator(array){
|
||||
{value: array[nextIndex++], done: false} :
|
||||
{value: undefined, done: true};
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
@ -60,7 +60,7 @@ function makeIterator(array){
|
||||
{value: array[nextIndex++]} :
|
||||
{done: true};
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
@ -81,7 +81,7 @@ function idMaker(){
|
||||
next: function() {
|
||||
return {value: index++, done: false};
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
@ -186,11 +186,11 @@ Obj.prototype[Symbol.iterator] = function(){
|
||||
return {
|
||||
done: done,
|
||||
value: value
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
done: true
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
return iterator;
|
||||
@ -204,7 +204,7 @@ one.next = two;
|
||||
two.next = three;
|
||||
|
||||
for (var i of one){
|
||||
console.log(i)
|
||||
console.log(i);
|
||||
}
|
||||
// 1
|
||||
// 2
|
||||
|
Loading…
x
Reference in New Issue
Block a user