I was trying to to get duration of audio files using creating audio Constructor in a for Each Loop but audioElement.duration is returning NaN only. Here's my code.
let audioArray = [
'1.mp3',
'2.mp3',
'3.mp3',
'4.mp3'
]
let audioElement;
audioArray.forEach((element)=>{
audioElement = new Audio(element);
console.log(audioElement.duration);
})