Help please me with javascript!

Okay I’m studying Javascript and I am understanding BUT now I’m stuck with the record challenge. I know what I’m doing thanks to hints but i don’t know why I’m doing. Plus there is still something wrong… Please someone can help me the use of javascript so that I can do them also in purpose in the future for other projects?

Cheers x

What code do you have so far? It’s a lot easier to troubleshoot when we can see your code

1 Like

Yes, usually the more specific your question is, the better the answers will be, both in terms of quantity and quality.

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

here is my code. but can you tell me also in the profesional life how am i suppose to understand to use these?

This case is all the way down at the bottom, but you don’t always check that value isn’t “”, so sometimes you set a track to “” instead of deleting, though I don’t think the tests actually cover this case.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Also, you have a typo here

It was one of the hints so i included it. Thank you so much!!

Thanks for your both answers!! I haven’t seen it! :frowning:

it should be hasOwnProperty()
No capital R.


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