---
id: 69a890af247de743333bd4ce
title: "Challenge 225: No Consecutive Repeats"
challengeType: 28
dashedName: challenge-225
---

# --description--

Given a string, determine if it has no repeating characters.

- A string has no repeats if it does not have the same character two or more times in a row.

# --hints--

`hasNoRepeats("hi world")` should return `true`.

```js
assert.isTrue(hasNoRepeats("hi world"));
```

`hasNoRepeats("hello world")` should return `false`.

```js
assert.isFalse(hasNoRepeats("hello world"));
```

`hasNoRepeats("abcdefghijklmnopqrstuvwxyz")` should return `true`.

```js
assert.isTrue(hasNoRepeats("abcdefghijklmnopqrstuvwxyz"));
```

`hasNoRepeats("freeCodeCamp")` should return `false`.

```js
assert.isFalse(hasNoRepeats("freeCodeCamp"));
```

`hasNoRepeats("The quick brown fox jumped over the lazy dog.")` should return `true`.

```js
assert.isTrue(hasNoRepeats("The quick brown fox jumped over the lazy dog."));
```

`hasNoRepeats("Mississippi")` should return `false`.

```js
assert.isFalse(hasNoRepeats("Mississippi"));
```

# --seed--

## --seed-contents--

```js
function hasNoRepeats(str) {

  return str;
}
```

# --solutions--

```js
function hasNoRepeats(str) {
  for (let i = 1; i < str.length; i++) {
    if (str[i] === str[i - 1]) {
      return false;
    }
  }
  return true;
}
```
