Why does console come out as undefined?
var ages = [3, 10, 18, 20];
function zxc(data, dataArray){
dataArray.findIndex(function(element){
return element == data;
});
}
console.log(zxc(18, ages)) //undefined
it"s no problem to write like this
var ages = [3, 10, 18, 20];
var zxc = ages.findIndex(function(element){
return element == 18;
});
console.log(zxc) //2