Skip to content

Commit

Permalink
fix: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Aug 13, 2019
1 parent d173f42 commit 5de7aca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/v8-tips/inline-initialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In this example, the individual assignments are performed one after the other, a
A more immediate solution is to attach all the information in one call:

```js
var array = [ 77, 88, 0.5, true ]
var array = [77, 88, 0.5, true]
```

Now, the compiler knows the types of all of the elements in the literal, and the **hidden class** can be determined up front.
Expand Down
2 changes: 1 addition & 1 deletion docs/workflow/how-to-clone.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This means that the original value and the value passed through the function hav
const clonePrimitive = value => value

let primitive = 123
let anotherPrimitive = clonePrimitive(primitive)
const anotherPrimitive = clonePrimitive(primitive)

// let's modify the original value
primitive = 456
Expand Down
14 changes: 9 additions & 5 deletions docs/workflow/lookup-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,22 @@ if (value < 5) {
}
```

Using `switch` makes the code more readable when you have lot `if/else` statements.

## Index lookups

Sometimes it is better to use a direct match approach using object/array index lookups:
Sometimes you can write the code in a way you don't need to evaluate conditions to reach the right subroutine.

You can use an `object` or `array` for doing direct match index lookups:

```js
var lookupTable = {
'1': 'is greater',
const lookupTable = {
1: 'is greater',
'-1': 'is less',
'0': 'is equal'
0: 'is equal'
}

var myValue = 5
const myValue = 5

lookupTable[compare(4, myValue)]
```
Expand Down

0 comments on commit 5de7aca

Please sign in to comment.