I would like to have a function run for every item in an array. The array is different every time but for this I will just use an example array. It keeps saying undefined is not a function at the, I assume undefined being foreachfunction. Whats the solution to this?
const bar1beats = [0.5, 1, 2.5]
generate.addEventListener('click', generateclick)
function generateclick(){
// error line
bar1beats.forEach(foreachfunction());
function foreachfunction(item, index){
let interval = intervals[Math.floor(Math.random() * intervals.length)]
interval();
if(interval == fifthfunction){
findnotefifth()
}
if(interval == fourthfunction){
findnotefourth()
}
}