Home > Software design >  How can I Locate a file in javascript?
How can I Locate a file in javascript?

Time:02-14

I am new to javascript and am wondering how to locate a file? Image

CodePudding user response:

if you mean to play audio in the HTML page, then just create an Audio object and use the play method:

const dingDong = new Audio('./Stuff/dingDong.mp3'); // path to the file
dingDong.play();

CodePudding user response:

I believe you are in doorbell.js, so const doorbell='./DingDong.mp3'

  • Related