Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Nov 25, 2015
1 parent b00c053 commit 42b9949
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ for (var b = 0; b < 10; b++) {
}
```

Any name used as property name that is not a string is stringified via `.toString()`, even numbers, so 1 becomes "1".

Also, `Arrays` in JavaScript are just `Objects` with magic length property.


## Monomorphic over Polymorphic types

Operations are monomorphic if the hidden classes of inputs are always the same - otherwise they are polymorphic, meaning some of the arguments can change type across different calls to the operation. For example, the second add() call in this example causes polymorphism:
Expand Down Expand Up @@ -119,7 +124,7 @@ lookupTable[compare(4, myValue)];

Also is totally more readable.

## Make your code faster with 'use strict'.
## More safe (and fast) code with 'use strict'.

From [MDN use strict](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) section:

Expand All @@ -133,13 +138,6 @@ In `node`, you can use the flag `--use_strict`, but is not recommended if you ha

Just calculate the value of something once, and reuse the value avoiding the cost of recalculate the same value.

This is very typical with `array.length`: If you need the value more than once, cache in a variable:

```js
var array = [1, 2, 3, 4, 5]
var arraySize = array.legnth;
```

If you need to control of a set of tiny values, you can use an object:

```js
Expand Down

0 comments on commit 42b9949

Please sign in to comment.