title: How to remove and add css animation property in single click with JavaScript
body: <p>I have a problem regarding the css animation triggering with JavaScript.
  This is my code snippet:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const signInBtn = document.querySelector('#signin-btn');
  
  function btnAnimation() {
    if (signInBtn.style.animation) {
      signInBtn.style.animation = '';
    } else {
      signInBtn.style.animation = 'btnAnimation 200ms linear';
    }
  }
  
  signInBtn.addEventListener('click', btnAnimation);</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  .wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  button {
    border: 2px solid black;
    border-radius: 25px;
    width: 100px;
    height: 40px;
  }
  
  button:focus {
    outline: none;
  }
  
  .wrapper .signin {
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  @keyframes btnAnimation {
    0% {
      transform: scale(1);
    }
    50% {
      transform: scale(.8);
    }
    100% {
      transform: scale(1);
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;div class="wrapper"&gt;
      &lt;div class="signin"&gt;
        &lt;button id="signin-btn"&gt;SIGN IN&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>So as you can see animation triggers every second click. I can't figure out how to add animation property after i removed it in &quot;if&quot; statement. I need this button to animate in every click. It is ok if you have a solution with jQuery but i would like to see pure JS solution. Thanks in advance.</p>