You should be on Exercism.io
Tags: javascript, firstyearincode, beginners, adventofcode
Published: 2019-10-16 18:54:21

Developers of all skill levels should be on [Exercism.io](https://exercism.io/). It's one of my favorite study tools as a new developer. While I was initially drawn to the site as a practice tool, I quickly realized that was the wrong approach. The reason is the slow pace you're forced to assume to get through the problems.

I know that sounds counterproductive, but stick with me.

[Exercism.io](https://exercism.io/) is a programming education site that focuses on problem solving. There are a 50 language tracks that students can join, including JavaScript, C++ and Typecript. 

The JavaScript track has 101 exercises which includes 18 core exercises. Each core exercise that you complete unlocks the next core exercise, as well as additional non-core problems that you can work on. But what sets Exercism.io apart is its mentor network of experienced developers. 

In order to progress through the core exercises, a mentor needs to review your solution for efficiency. So it's not just a matter of solving each challenge, but doing so in an efficient way.

Below is my solution to the Resistor Color exercise. I will include several my original answer, feedback from my mentor and the refactoring that followed to showcase the power in getting feedback from a more senior developer.

###The prompt:
Resistors have color coded bands, where each color maps to a number. The first 2 bands of a resistor have a simple encoding scheme: each color maps to a single number. Mnemonics map the colors to the numbers, that, when stored as an array, happen to map to their index in the array.

####Solution #1:
Because this was such an easy problem, I raced through the solution and submitted the thing to pass the tests.
```javascript
//
// This is only a SKELETON file for the 'Resistor Color' exercise. It's been provided as a
// convenience to get you started writing code faster.
//
  let colors = ["black","brown","red","orange","yellow","green","blue","violet","grey","white"]
export const colorCode = (string) => {

  return colors.indexOf(string)
};

export const COLORS = colors;
```
#####Feedback from my mentor
- L1 Remove dead comments.
- L5 Why not just name this COLORS and be done with it?
- L8 Is the return necessary?

####Solution #2:

```javascript
let colors = ["black","brown","red","orange","yellow","green","blue","violet","grey","white"]

export const colorCode = (string) => {
  return colors.indexOf(string)
};

export const COLORS= colors;
```
- L1-- removed the comments

- L5-- tried to rename the colors variable but that resulted in the following error

  -  `Support for the experimental syntax 'exportDefaultFrom' isn't currently enabled`

- L8-- also wasn't able to pass the tests without the return keyword. I think it is necessary for colorCode to explicitly return the result

####Solution #3:
In the end, I was able to `export const COLORS`. I learned the error  happened when I defined COLORS in line 1 and then tried to export it in line 7, instead of exporting it when I declared it. I left a comment explaining this for my mentor, who later clarified.

```javascript
export const COLORS  = ["black","brown","red","orange","yellow","green","blue","violet","grey","white"]

export const colorCode = (string) => {
  return COLORS.indexOf(string)
};
```

#####Feedback from my mentor
- Yes, you can't do that. I believe you're trying to say "export this single thing" with that syntax - but you've already told it you're exporting colorCode also.

 - https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export

- If you simply want to export them both the easiest way is to prefix them both with export (as you've already seen).

- Approving solution 3.

- And yes, is it possible to remove return with implicit return

####Solution #3 (final solution):
```javascript
export const COLORS = ["black","brown","red","orange","yellow","green","blue","violet","grey","white"]

export const colorCode = (string) => COLORS.indexOf(string)
```
####My final note to my mentor
- Can't believe how much more succinct this solution is compared to my first one. Thanks, you're a great mentor!

Personally, I'm a great fan of [Exercism.io](https://exercism.io/). More than just being able to write code, I want to be able to develop clean, thoughtful solutions to problems. 

####But there's a reason I said developers of <em>ALL</em> skill levels should be on Exercism:

That means you beginners and definitely you pros. 

Several months after my first Exercism solution, I've only made it through 5 core exercises. This is partly because of the many rewrites I go through before my solutions are approved. But this is also due to the many days it can take for a mentor to be assigned to review my solution.

It takes time for 112 JavaScript mentors to work through solutions submitted by 47,413 students. I've been suggesting [Exercism.io](https://exercism.io/) to any and everyone trying to learn JavaScript. Even though there are language tracks, I've learned a lot from the seemingly random feedback of my mentors.

So whether you're a newbie developer who could use the feedback or an experienced developer with feedback to offer, you should go [Exercism.io](https://exercism.io/) right now to create an account. Run- don't walk!

Also checkout this great [Exercism solutions blog](https://lulabromark.github.io/) I just found. I prefer to solve the problems first, but if I get stuck, I won't mind peeking!