HELP, i can't seem to pass the challenge!

Tell us what’s happening:
I can’t seem to pass the challenge, even though my code is the same as the solution code.

// running tests After updateRecords(collection, 2548, "artist", "") , artist should not be set After updateRecords(collection, 2548, "tracks", "") , tracks should not be set
// tests completed

This is the error message I keep getting.
Your code so far

// Setup
var collection = {
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 (object, id, prop, value) {
if (value === " ") {
  delete collection[id][prop];
} else if (prop === "tracks") {
  collection [id][prop] = collection [id][prop] || [];
}else {
  collection[id][prop] = value;
return collection;

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362.

Challenge: Record Collection

Link to the challenge:

This is checking for a string that contains a single space. Is that what you intended?

That and, what data object are you using inside the function? Did you want to use the global object? That would work fine on individual tests, but then the changes would accumulate, throwing off later tests.

When I make the change that Ariel suggests and the one that I suggest, it passes for me.

No, I meant to write a code that says “if value is empty”

"" === " " //this is false because a space is not the same as nothing.

Alright, so how do I write that value is equal to nothing.

Plus, even when I deleted the space between the string, the challenge still failed

It looks like you also often have spaces between “collection” and “[”, which will cause problems.

What exactly are you modifying with your function?

It takes an object as parameter, but you’re returning a variable called collection, which is defined outside the scope of the function.

(EDIT - see comment above by Kevin)

I did return object previously but the challenge failed. I guess I just got confused and decided to return collection.

I re-wrote the code just now and returned object. The challenge passed. Thank you.