summaryrefslogtreecommitdiffstats
path: root/js/README.md
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-22 01:26:06 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-22 01:26:06 +0200
commit780fa978642bf7004023e5a558744fa610f5bc32 (patch)
tree78d9b3192d650871fde1cbd424bdc69bcf7a514c /js/README.md
parent772b4e86c2fc106090d7c658157772614807f4e1 (diff)
add docs on iterators
Diffstat (limited to 'js/README.md')
-rw-r--r--js/README.md21
1 files changed, 19 insertions, 2 deletions
diff --git a/js/README.md b/js/README.md
index 8a46f598b..8e2a373da 100644
--- a/js/README.md
+++ b/js/README.md
@@ -9,8 +9,25 @@ then run:
The news app uses [Traceur](https://github.com/google/traceur-compiler) to transpile ES6 into ES5. If you want to take a look at the features see [the language features reference](https://github.com/google/traceur-compiler/wiki/LanguageFeatures#language-features).
-* Modules can not be used since the code is inlined
-* The following iterators are available: **items**
+### Iterator
+The following iterators are defined and availabe:
+
+* **items**:
+
+ ```js
+ // iterate over object key and value
+ for (let [key, value] of items(obj)) {
+ console.log(`object key: ${key}, object value: ${value}`)
+ }
+ ```
+* **enumerate**:
+
+ ```js
+ // iterate over object key and value
+ for (let [index, value] of enumerate(list)) {
+ console.log(`at position: ${index}, value is: ${value}`)
+ }
+ ```
## Building
Watch mode: