Problem Solving & Javascript

Oliver Stigley

dates 25 March

I've always loved solving problems. The reward of fixing something is great. I find writing code rewarding in that sense, it is often an exercise in debugging and problem solving .

Over the last few weeks I have been introduced to various ways of debugging, and approaching problems. Psuedocode was a new concept to me, but I like it. I find it prevents me running with a solution before I have thought about it properly. Often my solutions will lead me down the garden path, and a bit of psuedocode helps me stay on track.

I'm also a big fan of understanding an error message before jumping to a conclusion. It is easy to overlook these little things. Combining this with some console logging, and the Chrome dev tools, makes for a great tool belt.

Javascript

I have no reasonable segway for you here, but I have to write about the below as part of this week's assignment.

The .map() function is used to transform an array in to something else. It will take each array item, and perform a calculation on it that is prescribed the map parentheses.

The .filter() function is used to weed out item of an array in to something else. It will take each array item, and check if it meets a criteria. If it does, it is passed back in to a new, filtered array.

The .reduce() function is used to make a calculation of each array item, and will produce one number at the end. It could be used to add all the numbers in an array together, reducing the array to one number.