Basic JavaScript: Record Collection -?

Tell us what’s happening:
I am trying to access this information in the object but it is not passing in the test. So I’ve got this to work by myself in the web browsers console by using a string name for the track objects instead of the ints that are used in the example and it works, but using numbers for the objects throws: SyntaxError: unexpected token: numeric literal

The challenge doesn’t want me to change that information… am I missing something?

Your code so far

//console work
collection = {
    artist: "Kele",
    song: "I am sad",
    album: "Saddness"
//cofirmation object was created
Object { 4123: {…} }
//run code below
// ERR: SyntaxError: unexpected token: numeric literal

// 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 (prop != "tracks" && value != ""){ = value;

return collection;

updateRecords(5439, "artist", "ABBA");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0.

Challenge: Record Collection

Link to the challenge:

You should only change code below the line specified by the comment.

I’m well aware of that. The code on top is commented and I supposed not well enough on what I tested in the browser console. The error there I got explicitly states that the integer based number of the obj throws an error, so if I can’t change the dictionary/obj names of the challenge, in what context are integer based naming conventions okay ?

(everything under //setup is the original challenge)

To reference a property name that is a number in JavaScript, you must use bracket notation:



1 Like

Ah yes, of course. I appreciate it.