Basic JavaScript - Record Collection

Tell us what’s happening:
I have transcribed the solution of this exercise to the terminal in the page due that I am still very new to programming and I know what the operators and characters do but I don’t understand how am I supposed to understand exactly what the exercise asks of me. For example on some lines of the code the [id][prop] = value part. How am I supposed to know that I have to write that exactly like that? I still don’t understand why? Or for example the missing values of the records, how am I supposed to know how to write exactly what is asked from me? I don’t know if I’m being clear. How do I know that in some lines I have to say in javascript that I need a certain kind of type or value if I don’t have the data yet? I have been struggling with functions since I started to learn to program and I think is kind of a complex topic if like me, you still don’t get things like these. Sorry for asking but it just does not make sense to me to write a function before of knowing the data, (is hard for me to imagine values without knowing what the exact data is) I know it is not necessary perhaps and it will always be like that because I am learning to program and not data entry. Is there any easy way of understanding these kind of things or will I keep on always struggling? Usually my code starts with an idea of what I’m doing but I always end transcribing hard solutions, I hope to understand the whys of things and when to write this or that because I really want to learn the most I can. Well thank you and sorry if I sound very newbie, which I really am. Thanks and thank you for any learning suggestions. Also thanks to freecodecamp for the teachings


I understand what the function does if I transcribe it but I cannot come up with such a complex function/solution myself like the one in this exercise yet

Your code so far

// Setup
const recordCollection = {
  2548: {
    albumTitle: 'Slippery When Wet',
    artist: 'Bon Jovi',
    tracks: ['Let It Rock', 'You Give Love a Bad Name']
  2468: {
    albumTitle: '1999',
    artist: 'Prince',
    tracks: ['1999', 'Little Red Corvette']
  1245: {
    artist: 'Robert Palmer',
    tracks: []
  5439: {
    albumTitle: 'ABBA Gold'

// Only change code below this line
function updateRecords(records, id, prop, value) {
  if (prop !== 'tracks' && value !== "") {
        records[id][prop] = value;
          } else if (prop === "tracks" && records[id].hasOwnProperty("tracks") === false) {
              records[id][prop] = [value];
                } else if (prop === "tracks" && value !== "") {
                      } else if (value === "") {
                          delete records[id][prop];
                              return records;

updateRecords(recordCollection, 5439, 'artist', 'ABBA');

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 12; SM-G988U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.5249.126 Mobile Safari/537.36 OPR/72.2.3767.68393

Challenge: Basic JavaScript - Record Collection

Link to the challenge:

Reading code and writing code are two completely different skills. I’d stop reading answers before you solve the challenges immediately.

We can help you develop a plan if you ask questions on the forum before you read the answer. We can also help you turn that plan into code or help you find bugs in your code.

did you even read what I wrote? I don’t do it every time. I have done it like twice if anything. You shouldn’t post answers then if you don’t want people to look at them. Also it’s not like coding is the easiest task of the planet. Don’t worry, I’m not a plagiarist, I have done it only in extreme cases and I won’t do it anymore . I’ll find a way, here or in the thousand pages around the world. Please don’t talk down to me dude, you sound like my father

I’m not talking down to you. I am giving you honest, serious advice.

I didn’t say anything about plagarism.

I read your post and my answer is exactly what I recommend

You ask questions

Assigning values is covered previously but you can ask a question if you are unsure

You will have a description of the data. If that description is unclear, you ask questions

It is complex. Coding is hard. You get better with practice and questions.

You were given a description of the data and sample inputs. When the description doesn’t make sense, ask questions.

Coding is hard. You should ask questions when stuck. That’s what we do on the job.

Writing and reading code are two different skills. We can help you create that plan or fix that plan when it goes wrong. The plan will go wrong- that’s how coding works.

TLDR, reading and writing are different skills and you should not read answers before you write one. We can help you, if you ask questions. Asking questions will help build up your ability to write code. Reading code won’t really help much.

…all of which is a long version of saying

Reading is an important skill to learn. Its just a different skill than writing. Writing code is hard and askusg questions helps.

Asking questions and getting help is the ‘magic cheat code’ for programming that makes learning faster. And, its also good practice for interacting on professional technical topics, so double bonus.

Ok. Thanks. Sorry, yesterday night I was kinda tired after trying too many times that code and plus I’ve been working without days off for more than a week straight and I have one more week and a half to go. That’s why I want to learn coding so I can switch careers because I’m in dead end jobs since years ago and I know I gotta do something about it but it is kinda hard since my job almost consumes all my energy and sometimes I have to sleep late trying to learn programming so I get too little sleep on occasions. I didn’t mean to be rude with you, I apologize. If anything I might not be a good fit for programming and perhaps one day I will just have to face it. I also do it for the money because I know is well paid but if I can’t learn I’ll just have to give up. I’ve tried like three times counting this one and there is always the same pattern so I’ll give it a last try. I can see already this is harder than I thought. Thanks for your answers and sorry again for being mean yesterday, I was tired and irritated in my defense. I promise to ask questions next time and not transcribe anything ever again.

Also I understand you are a mod and you are just doing your job and you are doing pretty good so kudos for that.

Thanks! have a nice one! :+1:

Unfortunately, this stuff is definitely hard if you have lots of time to invest. I honestly believe anyone can lean to code, but not everyone has the time or finds it interesting.

We do what we can - we’re here to answer questions and give free tutoring on the forum and Discord.

Well I always have a mentality of I can do it!, you are probably right, coding might be hard but it is not impossible. The adidas slogan is impossible is nothing. Let’s do this. Sorry again for the bad mood the other day and thanks to Mr Quincy and to all of you guys for making all of this possible :+1:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.