Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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()})



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.


Exactly these were the challenges I faced when using plain js




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: