This week we built a chat bot to learn how functions work and to learn how to manipulate the DOM.
Getting hold of DOM-elements with getElementById, inserting new elements in the DOM by changing the innerHTML. Building functions, with a lot of if/else statements. When I realised the point of making variables global, it made it a lot easier to build different functions. If I had more time I would have tried to build more functions to be able to clean up my code and make it all look a bit more tidy. At the moment the functions contain a lot of loose code and it can be hard to follow the logic in some places. I’m using a nested if/else statement for coming up with gift suggestions but I think I could make it neater by using arrays or objects. Although, I’m still not well acquainted enough with them to make it work.