title: Difference between .getAttribute and dataset in JS
body: <p>I have been using .getAttribute and today found out about .dataset, so i was wondering what the differences are and when should each be used.</p>
  
  <p>So here is an example. Let's say we have a paragraph:</p>
  
  <pre><code>&lt;p class="test" data-something="this is a test"&gt;some text&lt;/p&gt;
  </code></pre>
  
  <p>if we use .getAttribute</p>
  
  <pre><code>let testText = document.querySelector('.test');
  let testGetAttribute = testText.getAttribute('data-something');
  console.log(testGetAttribute);
  </code></pre>
  
  <p>we get as output "this is a test".</p>
  
  <p>if we use .dataset</p>
  
  <pre><code>let testText = document.querySelector('.test');
  let testDataset = testText.dataset.something;
  console.log(testDataset);
  </code></pre>
  
  <p>we also get "this is a test".</p>
  
  <p>So, is there a difference between this two approaches? Are there some benefits in using one over the other?</p>
  
  <p>Thank you!</p>