Are Eloquent chapter exercises a worthwhile use of time?

So it should go something like Work at a solution > Use the Hint > Solution?

Generally, it depends. It's not a rigid thing because you may find more or less difficulties in different exercises. But in general terms, it should go something like:

  1. Try to work a solution. Try hard and honestly hard.
  2. If you need it, use the hint and continue trying.
  3. Then: 3.1. If you can't reach a solution, then do try to search for either more hints or some help somewhere or, if all else fails, a solution you can read. 3.2. If you do reach a working solution, then give it another spin. That is, critically review your own solution again. See if you can see something that could be simpler, something that you're not really sure it's a good idea or that could be done differently. If there is, do try to fix it. In either case, now you can read other people's solutions. But don't just notice that "it's different". Instead try to see why it is so. Is the other solution better? Why? What makes it better? (Note that there may also be differences which are minor ones and don't really matter so much.)

If you do this, then you'll be making a honest effort to solve the exercises, which is an excellent way to learn and very efficient. But also, that "second spin" will make you think more about the solution you reached and trying to identify things that "could be better" is also very good. Finally, after all that, actually comparing with other solutions gives you different perspectives, but this, again, is best if you do go that extra step to really analyse why they did it differently and why that matters -if it does-.

As for "using built-in methods"... That depends on the exercise. You'll need to decide on your own. I'd say that you can generally use them. But if you notice that it "feels like cheating", that is, that it solves too much of the problem, then the exercise is probably meant to be solved without those methods.

Say an exercise is "write a function that get the position of an element in an array" and you go and use arr.indexOf(element). Well, that works... and yes, in a production environment that is exactly what you would be writing. But as an exercise it's clear that it was meant for you to actually implement the search in the array, not use the existing method.

/r/learnjavascript Thread Parent