Bite-sized scripts for everyday use. Tweets will largely cover front-end development technologies: HTML, CSS, and JavaScript. Managed by @jonathansampson
Both Alt and Ctrl keys on your keyboard produce character 65, so how can you tell which is which?
The KeyboardEvent.location property tells you the location of the key on your keyboard: 1 means left, and 2 means right (0 for keys with no ambiguity).
Need to pad your strings? Now you can with padStart and padEnd. You can even provide a pad character:
› "Hello".padStart(10)
‹ " Hello"
› "Hello".padEnd(10)
‹ "Hello "
› "Hello".padEnd(10, ".")
‹ "Hello....."