Good progress made today completing about 30% of the remaining basic JS module on FCC. Learnt a hell of a lot in doing it and struggled in some areas but then surprised myself in some places in getting the answers straight off. Its going to be a long learning curve as I start to use JS more and more but its something I have been wanting to do for ages but always struggled to get my head around it. So the more I learn from it the better.
The one area I found a little bit of a struggle was on the Record Collection Challenge. You had to update JSON entries using checks against arrays and values etc. This ended up being the final code (JSON not included).
function updateRecords(object, id, prop, value) {
//Check if property in value isnt tracks and value is not empty then update the prop from value given
if (prop !== 'tracks' && value !== "") {
object[id][prop] = value;
//Check if prop in value is tracks but album does not have a tracks property then create empty array and add value to it
} else if (prop === "tracks" && !object[id].hasOwnProperty("tracks")) {
object[id][prop] = [value];
//Check if prop is tracks and value existing is not blank - therefore push new value to the end of the row
} else if (prop === "tracks" && value !== "") {
object[id][prop].push(value);
//Check if value given is empty - therefore delete existing object from prop
} else if (value === "") {
delete object[id][prop];
}
return object;
}
What have I completed today
- Basic Javascript - FCC
What is next on the list
- FCC ES6
- Further investigation into using Vue as a platform going forward as well as incorporating Tailwind CSS.
What have I been reading / watching?
- Vue
- FCC JS Concepts