Hi all, I noticed that when going through the exercises on the App Academy Open course, my code is slightly different to the answer but the results given are the same. Apologies for the basic question, but is it possible to write code in more than one way and still get the same results? Or is it more about best practises
Yep, there are generally multiple ways of writing code and still arriving at the same results. The idea is usually to utilize whatever you have learned in previous lessons but there is also nothing wrong with looking up/googling docs to write out your solution.
Good example is looking at sites like https://www.codewars.com where you’ll be able to see 1000s of different solutions submitted for the same given exercise.
I think in general, it is better to write readable code (that another programmer can understand) than, for instance, trying to compress code into as little lines as possible.
Hope that helps!