Tell us what’s happening:
I entered my code (see below) in the challenge and wanted to test. Nothing happens on screen. I took a look at the web console and got the impression that something might be wrong with the site:
When I click ‘Run the tests’ I get two ‘Invalid object’ errors in the console, referencing both transformers.js:85:clock6:
Here is the console output:
Invalid object transformers.js:85:6
o/<
transformers.js:85:6
b
polyvinyl.js:192:29
E
polyvinyl.js:204:7
n
_apply.js:15
u
_createPartial.js:38
r/</<
_createFlow.js:68
n
_apply.js:14
r/<
cond.js:54
n
_apply.js:14
r/<
_overRest.js:32
s/</<
transformers.js:119:48
u</t.prototype._tryNext
mergeMap.js:122
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
o</t.prototype._subscribe
ScalarObservable.js:49
a</e.prototype._trySubscribe
Observable.js:172
a</e.prototype.subscribe
Observable.js:160
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
r
subscribeToResult.js:23
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
u</t.prototype._next
Subscriber.js:126
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
switchMap.js:126
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
switchMap.js:103
u</t.prototype._next
switchMap.js:96
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
o</t.prototype._subscribe
ScalarObservable.js:49
a</e.prototype._trySubscribe
Observable.js:172
a</e.prototype.subscribe
Observable.js:160
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
switchMap.js:69
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
catchError.js:79
a</e.prototype.subscribe
Observable.js:157
r
subscribeToResult.js:23
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype._subscribe
ArrayObservable.js:114
a</e.prototype._trySubscribe
Observable.js:172
a</e.prototype.subscribe
Observable.js:160
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
s</e.prototype.call
scan.js:69
a</e.prototype.subscribe
Observable.js:157
u</e.prototype.call
takeLast.js:65
a</e.prototype.subscribe
Observable.js:157
s</e.prototype.call
defaultIfEmpty.js:49
a</e.prototype.subscribe
Observable.js:157
r
subscribeToResult.js:23
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
l</t.prototype._subscribe
ReplaySubject.js:55
a</e.prototype._trySubscribe
Observable.js:172
f</t.prototype._trySubscribe
Subject.js:97
a</e.prototype.subscribe
Observable.js:160
i/<
shareReplay.js:34
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
s</e.prototype.call
map.js:56
a</e.prototype.subscribe
Observable.js:157
s</e.prototype.call
map.js:56
a</e.prototype.subscribe
Observable.js:157
r
subscribeToResult.js:23
f</t.prototype._complete
combineLatest.js:112
u</t.prototype.complete
Subscriber.js:115
u</t.prototype._subscribe
ArrayObservable.js:116
a</e.prototype._trySubscribe
Observable.js:172
a</e.prototype.subscribe
Observable.js:160
l</e.prototype.call
combineLatest.js:78
a</e.prototype.subscribe
Observable.js:157
s</e.prototype.call
map.js:56
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
ignoreElements.js:29
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
catchError.js:79
a</e.prototype.subscribe
Observable.js:157
r
subscribeToResult.js:23
u</t.prototype._innerSub
switchMap.js:103
u</t.prototype._next
switchMap.js:96
u</t.prototype.next
Subscriber.js:90
c</t.prototype.debouncedNext
debounceTime.js:98
i
debounceTime.js:114
s</t.prototype._execute
AsyncAction.js:111
s</t.prototype.execute
AsyncAction.js:86
o</t.prototype.flush
AsyncScheduler.js:36
Invalid object transformers.js:85:6
o/<
transformers.js:85:6
b
polyvinyl.js:192:29
E
polyvinyl.js:204:7
n
_apply.js:15
u
_createPartial.js:38
r/</<
_createFlow.js:68
n
_apply.js:14
r/<
cond.js:54
n
_apply.js:14
r/<
_overRest.js:32
s/</<
transformers.js:119:48
u</t.prototype._tryNext
mergeMap.js:122
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
o</t.prototype._subscribe
ScalarObservable.js:49
a</e.prototype._trySubscribe
Observable.js:172
a</e.prototype.subscribe
Observable.js:160
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
r
subscribeToResult.js:23
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
u</t.prototype._next
Subscriber.js:126
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
switchMap.js:126
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
switchMap.js:103
u</t.prototype._next
switchMap.js:96
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype.notifyNext
mergeMap.js:145
o</t.prototype._next
InnerSubscriber.js:23
u</t.prototype.next
Subscriber.js:90
r
subscribeToResult.js:17
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
o</t.prototype._subscribe
ScalarObservable.js:49
a</e.prototype._trySubscribe
Observable.js:172
a</e.prototype.subscribe
Observable.js:160
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
switchMap.js:69
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
catchError.js:79
a</e.prototype.subscribe
Observable.js:157
r
subscribeToResult.js:23
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
u</t.prototype._subscribe
ArrayObservable.js:114
a</e.prototype._trySubscribe
Observable.js:172
a</e.prototype.subscribe
Observable.js:160
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
s</e.prototype.call
scan.js:69
a</e.prototype.subscribe
Observable.js:157
u</e.prototype.call
takeLast.js:65
a</e.prototype.subscribe
Observable.js:157
s</e.prototype.call
defaultIfEmpty.js:49
a</e.prototype.subscribe
Observable.js:157
r
subscribeToResult.js:23
u</t.prototype._innerSub
mergeMap.js:132
u</t.prototype._tryNext
mergeMap.js:129
u</t.prototype._next
mergeMap.js:112
u</t.prototype.next
Subscriber.js:90
l</t.prototype._subscribe
ReplaySubject.js:55
a</e.prototype._trySubscribe
Observable.js:172
f</t.prototype._trySubscribe
Subject.js:97
a</e.prototype.subscribe
Observable.js:160
i/<
shareReplay.js:34
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
mergeMap.js:87
a</e.prototype.subscribe
Observable.js:157
r
subscribeToResult.js:23
f</t.prototype._complete
combineLatest.js:112
u</t.prototype.complete
Subscriber.js:115
u</t.prototype._subscribe
ArrayObservable.js:116
a</e.prototype._trySubscribe
Observable.js:172
a</e.prototype.subscribe
Observable.js:160
l</e.prototype.call
combineLatest.js:78
a</e.prototype.subscribe
Observable.js:157
s</e.prototype.call
map.js:56
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
ignoreElements.js:29
a</e.prototype.subscribe
Observable.js:157
a</e.prototype.call
catchError.js:79
a</e.prototype.subscribe
Observable.js:157
r
subscribeToResult.js:23
u</t.prototype._innerSub
switchMap.js:103
u</t.prototype._next
switchMap.js:96
u</t.prototype.next
Subscriber.js:90
c</t.prototype.debouncedNext
debounceTime.js:98
i
debounceTime.js:114
s</t.prototype._execute
AsyncAction.js:111
s</t.prototype.execute
AsyncAction.js:86
o</t.prototype.flush
AsyncScheduler.js:36
**Your code so far**
```js
// 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": [
"1999",
"Little Red Corvette"
]
},
"1245": {
"artist": "Robert Palmer",
"tracks": [ ]
},
"5439": {
"album": "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));
// Only change code below this line
function updateRecords(id, prop, value) {
switch (value){
case '':
delete collection.id.prop;
break;
default:
switch (prop){
case 'tracks':
if (!collection.id.hasOwnProperty('tracks')){
var array =[];
collection.id.tracks=array[];
}
default:
collection.id.prop.push(value);
}
}
return collection;
}
// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/record-collection/