I am using the below code to play an audio file for every second, the audio file is a second long and it basically a tick. The code will run only once and then I see the error in the console. My intention is to make it run every second until something is achieve then I can clear the Interval. This is the error I am getting in the console
Uncaught SyntaxError: Unexpected identifier
setInterval (async)
This is my code:
$('select[name=notsound]').change(function(){
var h = $(this).val();
var tickAudio = new Audio('https://www.sample.com/sounds/'+h+'');
setInterval(tickAudio.play(),1000);
});
I am not sure why is this happening, I am sure that I have made some error which is causing this issue, as it was working before I thought of giving it a different approach. Thank you for reading my query. :)