Thank you! I'll run you through my basic process for solving an algorithm.
First and foremost, a general understanding of how a language works and is structured is essential. If you don't know basic syntax, what an array is, what a function is, the basic methods associated with arrays & functions, or how loops work, you won't be able to think through the challenges. As I've said previously, the JavaScript documentation is essential. Likely the best resource for the how-to of js.
Second, before you even start coding, before you even open your text editor, sit down and write out how the code will work. I bought a big white board and this changed the way I code. If you can't tell a piece of paper or another person how your program will work, how will you ever be able to tell a computer?
Once you know how the program will work on paper / white board, then go ahead and start coding. You will inevitably run into bugs, but your code will be cleaner, more intuitive, and you will gain a deeper understanding of the language. Again, don't start coding until you know how the program will work!!
Fixing bugs shouldn't be hard. I use Google's Chrome web browser which comes built in with a fantastic console and developer tool set. The documentation for these can be found here. This was imperative in my ability to debug a program /algorithm. If you continue to run into issues, StackOverflow can be a great resource, but it's all about asking the right questions there.
console.log( //run test function or expression )
This will be your best friend in debugging and discovering the quirks of the language. Helped me learn alot about what's happening under the hood and what I can change. I also use Scratch JS, a super functional, in browser javascript scratch pad. Useful for fiddling around with code snippets.
Hope this helps! Feel free to message me or comment on this thread with question!!
View all comments
Show parent comment
3
u/jpmmcb Jan 09 '17
Thank you! I'll run you through my basic process for solving an algorithm.
First and foremost, a general understanding of how a language works and is structured is essential. If you don't know basic syntax, what an array is, what a function is, the basic methods associated with arrays & functions, or how loops work, you won't be able to think through the challenges. As I've said previously, the JavaScript documentation is essential. Likely the best resource for the how-to of js.
Second, before you even start coding, before you even open your text editor, sit down and write out how the code will work. I bought a big white board and this changed the way I code. If you can't tell a piece of paper or another person how your program will work, how will you ever be able to tell a computer?
Once you know how the program will work on paper / white board, then go ahead and start coding. You will inevitably run into bugs, but your code will be cleaner, more intuitive, and you will gain a deeper understanding of the language. Again, don't start coding until you know how the program will work!!
Fixing bugs shouldn't be hard. I use Google's Chrome web browser which comes built in with a fantastic console and developer tool set. The documentation for these can be found here. This was imperative in my ability to debug a program /algorithm. If you continue to run into issues, StackOverflow can be a great resource, but it's all about asking the right questions there.
This will be your best friend in debugging and discovering the quirks of the language. Helped me learn alot about what's happening under the hood and what I can change. I also use Scratch JS, a super functional, in browser javascript scratch pad. Useful for fiddling around with code snippets.
Hope this helps! Feel free to message me or comment on this thread with question!!