Comment

Comment by qayxc

challenge accepted (app #2, since #1 is just static), BEHOLD:

  <script>
  const Counter = () => {
    let counter = 0;
    const updCounter = (delta) => {
      counter += delta;
      document.getElementById('count').innerText = `♥ ${counter}`;
    };
    document.getElementById('up').addEventListener('click', () => updCounter(1));
    document.getElementById('down').addEventListener('click', () => updCounter(-1));
    updCounter(0);
  };
  Counter();
  </script>
  <span id="count"></span>
  <button id="up">*thumbs-up*</button>
  <button id="down">*thumbs-down*</button>
15 LoC vs 7 LoC, zero dependencies vs. 0.9kB gzipped or 2.7kB minified. Additional learning curve: 0h vs 1h (allegedly).

Honestly, I am biased and think Vanilla JS wins :D

parent qayxc 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton