Skip to content

Commit

Permalink
Merge pull request bevacqua#3 from aynik/master
Browse files Browse the repository at this point in the history
setTimeout arguments and noop
  • Loading branch information
bevacqua committed Aug 19, 2014
2 parents 6dfed02 + 6c52ab4 commit 3aa7850
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,17 @@ for (i = 0; i < values.length; i++) {
var values = [1, 2, 3];
var i;

for (i = 0; i < values.length; i++) {
setTimeout(function (i) {
console.log(values[i]);
}, 1000 * i, i);
}
```

```js
var values = [1, 2, 3];
var i;

for (i = 0; i < values.length; i++) {
wait(i);
}
Expand Down Expand Up @@ -708,11 +719,11 @@ emitter.on('click', function (elem) {
emitter.emit('click', document.body);
```

Use `Function.prototype` as a _"no-op"_.
Use `Function()` as a _"no-op"_.

```js
function (cb) {
setTimeout(cb || Function.prototype, 2000);
setTimeout(cb || Function(), 2000);
}
```

Expand Down

0 comments on commit 3aa7850

Please sign in to comment.