I'm still learning JavaScript. Not able to get past this:
function Fruits(category, berries, notberries) {
this.category = category;
this.berries = [];
this.notberries = [];
}
let f = new Fruits("fresh", ["strawberry", "raspberry"], ["apple", "mango"]);
console.log(f); // Fruits {category: "fresh", berries: Array(0), notberries: Array(0)}
f.category; //"fresh"
f.berries; //[]
Why is it not logging the values of berries and instead returning an empty array ?
this.berries = [];you've declaredberries' value as an empty array, regardless of the constructor's parameters