HenrikJoreteg / HenrikJoreteg/human-javascript

Code Inconsistency

Open
#64 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
CSS
Stars
82
Forks
7
PR merge metrics
No merged PRs in 30d

Description

In Writing Code for Humans, the section with the two similar examples is incorrect. The two examples actually do the OPPOSITE things. See Below:

Now, compare it to this:

```
// Same array:
var myArray = ['hello', 'something', 'awesome'];
if (myArray.indexOf('hello') == -1) {
// Pretty freakin' clear, AMIRITE!?
}
```

Or even this, using Underscore:

```
// Same array:
var myArray = ['hello', 'something', 'awesome'];
if (_(myArray).contains('hello')) {
// Also pretty freakin' clear right?
}
```

I would recommend changing the first example to this (but please do whatever is most clear.):

```
// Same array:
var myArray = ['hello', 'something', 'awesome'];
if (myArray.indexOf('hello') >= 0) {
// Pretty freakin' clear, AMIRITE!?
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.