FreeCodeCamp build a Drum Machine

I am really struggling to complete test 5 and have not even go to test 6. The sound seems to play but the test not passing. I am using Codepen and am using Babel, and React 17.02 and React DOM 17.02. My pen is below:

Drum Machine Codepen

I am really stuck with this. Please point me to where I am going wrong?

I think your issue might be related to the fact that you have duplicate id’s on elements. You have id="Q" on both the <button> and its parent <div>. Technically, id’s must be unique so you can’t do this in the first place. To pass the test, you should leave the id on the button only.

Thanks for this. I removed the id from the , but still dis not pass test . I realized I had the ID in the

and so have been able to simplify the code, so thank you very much for the inspiration.
Unfortunately I am still not passing test number 5. Are there any other suggestions I can try? My latest code is below:

FreeCodeCamp Drum Machine

You still have duplicate id’s. The <div> and the <audio> have the same id. Id’s need to be unique.

Also, use a <button> instead of a <div>. These are buttons.

Thanks, I will try this and let you know how I get on.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.