Why dot notation doesn't work for accessing property as variables?

Tell us what’s happening:
I am wondering why this is wrong?

if (value === "")
delete collection.id.prop;

where id and prop are variables.

This won’t work. My guess is because id and prop are variables and has to be converted to strings and that can only be done using the bracket notation [ ]. Is this right?

delete collection[id][prop] works. How would you use dot notation here to delete based on variable or is that not possible?

Your code so far

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

// Only change code below this line
function updateRecords(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(2548, "tracks", "");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36 Edg/83.0.478.44.

Challenge: Record Collection

Link to the challenge:

dot notation will just access the name you write, you can’t use it to access properties using variables

Your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution. In the future, if you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.

Thank you.