Play random sound effect via script call

I'm trying to play a random sound effect based on a variable.
My SE files have these names: sound1.ogg, sound2.ogg, ... sound9.ogg

Tried this:
Set the value of variable #24 to a random value between 1 and 9 via event.

Script:
AudioManager.playSe({name: 'sound'$gameVariables.value(24), pan: 0, pitch: 100, volume: 100});

Of course it didn't work, and it was the best idea I've ever had. I guess it's something simple, but I'm a complete noob in js. Can anyone help me with the code?
PHP:
let ran = ["1.ogg","2.ogg","3.ogg","4.ogg"][~~(Math.random()*4)];
AudioManager.playSe({name: `${ran}`, pan: 0, pitch: 50, volume: 70});

//or other sugest
PHP:
const list = ["1.ogg","2.ogg","3.ogg","4.ogg"];
AudioManager.playSe({name: `${list[~~(Math.random()*list.lenght)]}`, pan: 0, pitch: 50, volume: 70});
PHP:
let ran = ["1.ogg","2.ogg","3.ogg","4.ogg"][~~(Math.random()*4)];
AudioManager.playSe({name: `${ran}`, pan: 0, pitch: 50, volume: 70});

That didn't work, ran into some error related to that "let ran", but then I tried this:

x = ["sound1","sound2","sound3","sound4"][~~(Math.random()*4)];

AudioManager.playSe({name: x, pan: 0, pitch: 100, volume: 100});

Without the "let ran" and the file extensions, and it worked! Thank you!
That didn't work, ran into some error related to that "let ran", but then I tried this:



Without the "let ran" and the file extensions, and it worked! Thank you!
try replace let by var
try replace let by var

I get this error:
SyntaxError: Unexpected token var
PHP:
const list = ["1.ogg","2.ogg","3.ogg","4.ogg"];
AudioManager.playSe({name: `${list[~~(Math.random()*list.lenght)]}`, pan: 0, pitch: 50, volume: 70});

This one didn't work too.
it work on my side, you probably do a mistake ! ?
Can you send a print screen with the snippet and console error ?
it work on my side, you probably do a mistake ! ?
Can you send a print screen with the snippet and console error ?

It worked now, maybe I was typing something wrong. Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/play-random-sound-effect-via-script-call.94121/