Last sprint, I started learning javascript and got introduced to a lot of new concepts. One of which was how to use the loops and conditional statements. And that means there is a whole lot of syntaxes to get familiar to. For the if else statements, the syntax was:
if(something) { do something } else { do something else }
The task was pretty easy at the time, just use the if else statements to check if a variable is less than something then log a specific sentence to the console. However, I was missing the ( ) for the condition, so the code did not run as expected. I then went to the console to see what was the error message, but again, at the time things werent quite clear to me and I had no idea what the error was. If I was missing something on the syntax I expected the error message to be "missing something somewhere" but it was not it. I tried to change something in the code above, and then in the code below, nothing worked out. I then tried to google the error message but there werent actually anything helpful. Then I tried to look up the code line by line still didnt realize it. It was really frustrated throughout the process of trying to find what the problem was. I ended up deleting the whole thing and started from the beginning again. That is when I realize what I missed and fixed the problem. One thing I've learnt through this process is when you learn something, always try it out first. Do some examples, run it through a couple of very simple things until you get how it really works, then start working with it when you fully understand it.
Last sprint I worked with the Javascript-cafe. The exercise was
I want a feature where every product has a wholesaleCost property,
and each product has a Restock button next to it. Clicking the restock
button adds one more of that product to your stock, and subtracts the
wholesaleCost from your cash. If you don't have enough cash, an alert
pops up telling you that you can't restock.
First of all, I broke it down to smaller tasks:
Going through this process, I needed to break down the last task further:
Then, I used pseudo code to draft what I would need to make a proper Restock function.
It was a fun process to go through, however I think it requires a lot of patience and focus. I've learnt that it is much more easier to break things down into smaller chunks, solving them one by one and then join them together so we could solve the bigger problem.
So far, Im pretty confident with using these problem-solving techniques. However I need to improve my pseudo code as sometimes I think it was too detailed and sometimes it was not detailed enough so it was hard to understand what I mean even to myself.
I was never reluctant to ask for help. Whenever I ran into a problem, I try my best googling/researching/trying somethings and if none worked out I immidiately reach out for help in the group chat.