Hey guys,
So I was checking out new topics on free code camp at free code camp's forum section, and I stumbled upon a topic which was written by a lady where she stated she needed help to solve a problem ( link to the problem: https://forum.freecodecamp.org/t/help-not-able-to-solve/466164 ). And I decided to help her out in solving this. So exciting.
So I clicked on the link to the challenge, took the code to my vs code, and began to solve it. And after a while, I came up with this:
function updateRecords(records, id, prop, value) {
for (var property in records) {
if(Number(property) === id) {
if(prop !== 'tracks' && value !== ''){
recordCollection[`${property}`][`${prop}`] = value
}
else if(prop === 'tracks' && recordCollection[`${property}`].hasOwnProperty('tracks') === false){
recordCollection[`${property}`][`${prop}`] = [value]
}
else if(prop === 'tracks' && value !== ''){
recordCollection[`${property}`][`${prop}`].push(value)
}
else if(value === '') {
delete recordCollection[`${property}`][`${prop}`]
}
}
}
return records;
}
I tested my written code to make sure it was producing the right solution in my browser, and it did. Then I took the code and ran it on free codes camp's source-code editor at the challenge page and ran tests, and after all my hard work for a long period of time that code DID NOT PASS.
I began to wonder why? then I read the question again carefully. I noticed Free Code Camp gave a specific instruction on how the code should be written and I checked the "get the hint" link and saw what they meant.
So what's the Key principle I missed? "DETAILED INSTRUCTION". My code solved all the task it was meant to do, but because I didn't follow the instructions, so I failed. Free Code Camp's approach to solving problems doesn't just make you a problem solver, it also gives you a taste on how things are at the work field of a Software Developer.
There are times where instructions can come from your head of information technology or a senior developer or even your co-developer concerning what code to write that will help to improve the performance of the product you and your team are designing. And there is a structure on ground on specific patterns to be written which will favor such an app. But if you try your own way, without thinking deeply on those instructions, issues might develop on the product, or you might be writing cumbersome code which might be hard to read. However it is very important to reason this "why does he/she wants this approach? is there a simpler or better code to write than this? (it's possible for you to have a better approach in writing this)
and how will this approach favor the product? Before you charge in head long without listening to or reading the instruction.
So that's what free code camp did for me. It's been a while since I solved problems at free code camp. I'm definitely going back to finish my curriculum and achieve my full stack certificate. And for those who haven't tried it out, go check it out. Register and begin your journey to become a good software developer.
This is my first official post. I haven't blogged anything ever..... only once though, that I can remember. So forgive me if there is something I missed or a mistake I've made. But to wrap it up that's what I got been at such a good platform. Thanks' guys for reading this till the end and have a great time.
Top comments (0)