Writing a function for class and vscode saying argument not declared even though I am using it

20 Views Asked by At

Im a newbie to this coding thing and cant get over this hump in my practice problem. is says in my parameter when I have over it "is declared but value never read". I tried making it equal to something else but nothing. this is the function:

function pluck(arr,value) {
var obj = arr;
let val = [];
let name = value;
for (let i=0;i<obj.length;i++){
    val.push(`${obj[i].name}`);
}

return val; 

//this is part of my tss practice problems, i just need some more guidance on this. "value" is the thing im having problems with.

I tried renaming the "value" in the argument to "name" so i could use it in my obj[i].name function since im dealing with an array with objects nested inside. but "name" became the new thing not used.

0

There are 0 best solutions below