# CodeWars Even Or Odd help

**URL:** <https://forum.freecodecamp.org/t/codewars-even-or-odd-help/280538>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [May 30, 2019, 1:29am UTC](https://forum.freecodecamp.org/t/codewars-even-or-odd-help/280538 "2019-05-30T01:29:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sethstephanz](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sethstephanz/32/115154_2.png) [@sethstephanz](https://forum.freecodecamp.org/u/sethstephanz)\
**Post date:** [May 30, 2019, 1:29am UTC](https://forum.freecodecamp.org/t/codewars-even-or-odd-help/280538/1 "2019-05-30T01:29:20Z")

</div>

Can someone help me figure out the syntax code and figure out the correct answer?

Basically, if the input is even, it prints “Even”; if the input is odd, it prints “Odd”. Here’s my code so far:

```auto
function even_or_odd(number) {
  if (number % 2 === 0) {
  return("Even");
  }
  else {
  return("Odd");
}

```

And here’s the syntax code it throws:

```auto
/home/codewarrior/index.js:20
});
 ^

SyntaxError: Unexpected token )
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at [eval]:1:1

```

Thanks!

---

<div class="post-metadata">

**Author:** ![willjw3](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/willjw3/32/196790_2.png) [@willjw3](https://forum.freecodecamp.org/u/willjw3)\
**Post date:** [May 30, 2019, 1:45am UTC](https://forum.freecodecamp.org/t/codewars-even-or-odd-help/280538/2 "2019-05-30T01:45:25Z")

</div>

```auto
function even_or_odd(number) {
  if (number % 2 === 0) {
  return("Even");
  }
  else {
  return("Odd");
}

```

Just from looking at this, it seems you have one open curly brace.

---

<div class="post-metadata">

**Author:** ![sethstephanz](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sethstephanz/32/115154_2.png) [@sethstephanz](https://forum.freecodecamp.org/u/sethstephanz)\
**Post date:** [May 30, 2019, 1:46am UTC](https://forum.freecodecamp.org/t/codewars-even-or-odd-help/280538/3 "2019-05-30T01:46:54Z")

</div>

Thanks! Sorry for the basic bug. CodeWars’ interpreter isn’t exactly helpful (I guess that would defeat the point).

---

<div class="post-metadata">

**Author:** ![chris-tse](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/chris-tse/32/47141_2.png) [@chris-tse](https://forum.freecodecamp.org/u/chris-tse)\
**Post date:** [May 30, 2019, 4:34am UTC](https://forum.freecodecamp.org/t/codewars-even-or-odd-help/280538/4 "2019-05-30T04:34:05Z")

</div>

The simple ones and up being the hardest to notice.

This is why indentation and formatting, even if it’s optional, is quite important.

---

<div class="post-metadata">

**Author:** ![sethstephanz](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sethstephanz/32/115154_2.png) [@sethstephanz](https://forum.freecodecamp.org/u/sethstephanz)\
**Post date:** [May 31, 2019, 1:57am UTC](https://forum.freecodecamp.org/t/codewars-even-or-odd-help/280538/5 "2019-05-31T01:57:56Z")

</div>

Yep! I’m usually pretty good about indentation/levels, but was a little sloppy on this one and I guess I paid for it!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 25, 2021, 12:38pm UTC](https://forum.freecodecamp.org/t/codewars-even-or-odd-help/280538/6 "2021-01-25T12:38:27Z")

</div>

Closed on January 25, 2021, 12:38pm UTC


