I can't modify the function to return anything other than collection...
See original GitHub issueChallenge Record Collection has an issue.
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
// 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) {
//if exists function --
console.log("falsy");
return false;
}
// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
is it possible to not return anything from a function in python?
Functions always return something (at least None , when no return-statement was reached during execution and the end of the function is reached)....
Read more >The Python return Statement: Usage and Best Practices
Everything in Python is an object. So, your functions can return numeric values ( int , float , and complex values), collections and...
Read more >Object.defineProperty() - JavaScript - MDN Web Docs
This method allows a precise addition to or modification of a property on an object. Normal property addition through assignment creates ...
Read more >Function that manipulates collection and return the same type
It isn't generally possible to return a new collection, because you don't know what the constructor expects. I.e. type(original)(new_values) ...
Read more >Collection (Java Platform SE 8 ) - Oracle Help Center
The caller is thus free to modify the returned array. This method acts as bridge between array-based and collection-based APIs. Returns: an array...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have the same issue.
Change ‘return collection;’ for ‘return “I am a duck”;’ and see the ‘problem’.
So far in all the FCC challenges, the “return” in the main function shows the return value in the console. This challenge is different however as it always returns the collection regardless of what you put in it. It’s as if the return inside updateRecords is completely ignored for some reason.
I’m used to modify the return value in examples to debug, so I always play around with it. This prevents from doing that unfortunately.
@vedant15188 you are right about the goal of this challenge, however it is inconsistent with the way all the previous challenges showed return value in the console.
For the sake of consistency, I hope this will be looked into. Thanks!
Ummm according to me the function will always return collection…
The main aim of the challenge is to modify the copy of the Collection and then equate it back to the collections object… You can solve the challenge that way and the changes will be reflected on the collections #object too… It works for me.