fabio
#1
Guys,
When I use this code to update an object (inside or not a function - add a property with a value) it works:
collection[5439].artist = “ABBA”;
but when I use this function, it doesn’t work. where is my mistake?
function updateRecords(id, prop, value) {
collection[id].prop = “value”;
return collection;
}
console.log(updateRecords(5439, “artist”, “ABBA”));
Thanks.
Fábio.
Gunjan
#2
where you called the function ? it’s not getting inside the function
fabio
#3
I called the function inside the console.log. outside the function. Like I posted.
ansdb
#4
i think you need to call it inside the function?
Gunjan
#5
called function should end with semicolon
updateRecords(5439, “artist”, “ABBA”);
fabio
#6

I think the syntax is corret.
fabio
#7
Man, I don’t get it, call inside the function?
Gunjan
#8
Now you get that
yeah now it’s correct
fabio
#9
I used correct syntax before. It doesn’t work. I don’t get it.
fabio
#10
I had to do this way: 
and Not this way: collection[id].prop = “value”;
I got it. Thanks everybody.