Sound | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Sound

How can I make a sound in js and wrap it in a function, and I need the sound to play 1 time when I call it

30th Nov 2019, 6:47 AM
No Activity
No Activity - avatar
8 Answers
+ 9
White Cat Studios Use the Audio() object of Javascript for achieving that. Audio allows you to have a audio and play it whenever you want. For example var sound = new Audio(); sound.src = "audiolink"; When you want to play sound.play()
30th Nov 2019, 6:57 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 6
🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! You should answer only if you know the answer. I really don't see any reason of saying "search on google".
30th Nov 2019, 6:55 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 6
Sir 🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! Actually every single thing asked on this Q/A is available on Google. Stack overflow is much much much bigger and advanced. So we could recommend every single one to go on Google, can we? No You can always suggest them Google but give some links they can refer to directly 😉😉
30th Nov 2019, 7:59 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 4
🐼 Coding Panda 🐼 I know the answer but if we can easily get on Google then I can suggest. No offense.
30th Nov 2019, 7:57 AM
A͢J
A͢J - avatar
30th Nov 2019, 8:04 AM
$hardul B
$hardul B - avatar
+ 1
Try to find on Google.
30th Nov 2019, 6:49 AM
A͢J
A͢J - avatar
+ 1
$hardul B Ok then I will ask what is java and no-one can say this is basic things or you can get on Google.😂😂
30th Nov 2019, 8:08 AM
A͢J
A͢J - avatar
30th Nov 2019, 8:10 AM
$hardul B
$hardul B - avatar