Currently, I am in the midst of an evaluation where I have the freedom to utilize any resources at my disposal. The task at hand involves using the .filter method to remove objects without a specific key. Here is the provided prompt...
Create a function named cookieLoversOnly that receives an array and filters out any object that does not contain the key favoriteCookie. The filtered array should be returned by the cookieLoversOnly function.
This code represents my progress so far...
function cookieLoversOnly(arr){
return arr.filter(e => arr[e]===favoriteCookie)
}