How Can I Import All (mp3) Files From A Particular Folder Into An Array In React.js?
I'm building an mp3 player with react.js and the HTML5 web audio API. I'm new to react (circa 2 weeks) but have 3 years experience with JavaScript. It seems that in order for the m
Solution 1:
var mp3_file = []
mp3_file[0] = 'file1',
mp3_file[1] = 'file2',
mp3_file[2] = 'file3',
mp3_file[3] = 'file4',
mp3_file[4] = 'file5',
mp3_file[5] = 'file6',
mp3_file[6] = 'file7',
mp3s = [];
for (let i=0; i<6; i++) {
mp3s[i] = mp3_file[i]
console.log(mp3s[i])
}
RESULT >
"file1""file2"and so on.
And also this could be interesting
var mp3_file = [];
var mp3s = [];
for (let i=0; i<6; i++) {
mp3_file[i = 'file' + i,
}
for (let i=0; i<mp3_file.length; i++) {
mp3s[i] = mp3_file[i]
console.log(mp3s[i])
}
Have "pros" and "contras" but I think you'll get the point.
Post a Comment for "How Can I Import All (mp3) Files From A Particular Folder Into An Array In React.js?"