<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Emmanuel</title>
    <description>The latest articles on DEV Community by Emmanuel (@still_fatolu).</description>
    <link>https://dev.to/still_fatolu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3266470%2F2b6245a1-7c03-46b9-94ff-458b05b6f498.png</url>
      <title>DEV Community: Emmanuel</title>
      <link>https://dev.to/still_fatolu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/still_fatolu"/>
    <language>en</language>
    <item>
      <title>javascript30 journey - day 1</title>
      <dc:creator>Emmanuel</dc:creator>
      <pubDate>Sat, 02 Aug 2025 19:00:10 +0000</pubDate>
      <link>https://dev.to/still_fatolu/javascript30-journey-day-1-2cl9</link>
      <guid>https://dev.to/still_fatolu/javascript30-journey-day-1-2cl9</guid>
      <description>&lt;p&gt;The first lesson on Javascript30 is building a drum kit (I built mine &lt;a href="https://javascript30-projects.vercel.app/drumkit/drumkit.html" rel="noopener noreferrer"&gt;check it out&lt;/a&gt;) its a really fun project, here's a summary of how it works.&lt;/p&gt;

&lt;p&gt;First we need to created nine(9) divs to represent all the sounds present.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjsayvkw2guigd92jomp5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjsayvkw2guigd92jomp5.png" alt="browser view" width="800" height="272"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The sounds are all different, each div represents a sound, to actually play the sound we need to create 9 audio elements.&lt;br&gt;
Normally the audio element won't appear in the browser if you add just the 'src' attribute without any other thing. you should still declare 'display: none' in the CSS file regardless.&lt;/p&gt;

&lt;p&gt;One important thing in the div elements is the addition of custom attribute using the 'data-' attribute . In this project we added the KeyboardEvent.code value of every letter as an attribute to it.&lt;br&gt;
For example : 'data-key = keyA' and also to it corresponding sound in the audio element. This will be useful in the Javascript code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1mnoy3c5bg2eu4dvvj3f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1mnoy3c5bg2eu4dvvj3f.png" alt="HTML Code" width="590" height="883"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After creating the all HTML elements and styling with CSS, the major task  is the functionality:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fustvc9goze7yp9bt7jfu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fustvc9goze7yp9bt7jfu.png" alt="javascript code" width="800" height="628"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;for the Javascript code, three(3) main functions are needed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The first function is the playsound function.&lt;/li&gt;
&lt;li&gt;The second is the addTransition function.&lt;/li&gt;
&lt;li&gt;Then the removeTransition function.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The playSound function will be a callback function in the keydown event listener.&lt;br&gt;
it plays the sound of the audio element containing the same attribute as the  element of the key clicked .&lt;br&gt;
it also calls the addTransition function.&lt;br&gt;
An important part of the code is "audio.currentTime = 0" line.&lt;br&gt;
Its make sure the audio element plays the sound every single time the playSound function is called(it stops any current sound that was previously played)&lt;/p&gt;

&lt;p&gt;The addTransition function adds the class "playing" to any div that was clicked to give it that nice quick bouncy transition.&lt;/p&gt;

&lt;p&gt;The removeTransition function as the name states removes the transition on any clicked element by removing the class "playing". Its passed as a callback function to the "transitionend" event listener.&lt;/p&gt;

&lt;p&gt;After creating all three(3) functions we'll create the keydown event which calls the playsound function .&lt;br&gt;
Then we get all the divs representing different sounds and pass the transitionend event which calls the remove transition function to each of them using the forEach method.&lt;/p&gt;

&lt;p&gt;that's all guys, you've successfully created a drumkit. &lt;br&gt;
super grateful to &lt;a href="https://x.com/wesbos" rel="noopener noreferrer"&gt;wesbos&lt;/a&gt;  for creating such an amazing resource. &lt;br&gt;
visit &lt;a href="https://JavaScript30.com" rel="noopener noreferrer"&gt;javascript30&lt;/a&gt; to join me in sharpening your javascript skills.&lt;/p&gt;

&lt;p&gt;✌️&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
