News for hackers. Stuff that matters.
Re:Show HN: A TO-DO app that fits inside a single tweet by numlock86 on Monday December 21, 2020 @02:51AM (#25492945)
Care to elaborate? There are some nifty tricks when it comes to golfing JS.
Re:Show HN: A TO-DO app that fits inside a single tweet by rukshn on Monday December 21, 2020 @03:24AM (#25493090)
Well sorry I was in a hurry when I typed the above comment

Well the body can’t have any dom elements according to the challenger

That means I had to create the dom elements as well and I was unable to figure out a way within the given character limit

Re:Show HN: A TO-DO app that fits inside a single tweet by tdeck on Monday December 21, 2020 @04:14AM (#25493309)
I wonder if document.write() would work for you. The old-fashioned APIs from before the DOM era (e.g innerHTML, innerText) generally seem to be a lot shorter although they're still a bit verbose.
Re:Show HN: A TO-DO app that fits inside a single tweet by rukshn on Monday December 21, 2020 @05:06AM (#25493539)
Yes I guess that was the right way all along, I saw a comment on this thread using innerHtml and write
Re:Show HN: A TO-DO app that fits inside a single tweet by bamboleo on Monday December 21, 2020 @03:32AM (#25493133)
JS is ok, it’s the DOM APIs that are verbose. I mean this is just to handle the enter key:

    f.addEventListener('keypress',e=>{if(e.keyCode==000) etc()})
Re:Show HN: A TO-DO app that fits inside a single tweet by tdeck on Monday December 21, 2020 @04:03AM (#25493272)
Just a fun note: You can replace this

    f.addEventListener('keypress',e=>{...})
With the older but essentially equivalent

    f.onkeypress=e=>{...}
and save 18 characters. You can even use `onkeyup` and save 3 more characters.
Re:Show HN: A TO-DO app that fits inside a single tweet by rukshn on Monday December 21, 2020 @03:38AM (#25493163)
Exactly these were the challenges I faced when using plain js