Hello everyone I struggling to create an expression to check if a specific array includes only a specified type values.Here is what I tried :
const isArrayOfType = (arr, type) =>
arr.forEach((item) => typeof item == type) ? true : false;
const arr = [1, 2, 3];
const typ = 'number';
console.log(isArrayOfType(arr, typ));
The main goal is to not use return in the expression.