
Bristol JS
A friendly JavaScript group in the lovely city of Bristol
233
Members
29
Events
Tags
JavaScript Node.js React Angular Vue.js Front-end Back-endSponsors



What are TIL's?
TIL stands for Today I Learned... it's a place to share knowledge, tips and tricks with other members in your community. Snippets are up to 1500 characters.
When you are pairing sometimes only the host gets credited for praise/blame with pairing commits.
Today I learned that you can add a co-author:
git commit -m "Commit description
>
>
Co-authored-by: John Smith <john.smith@acme.inc>"
Just add 2 blank lines then the co-author message in.
It will be shown like this in GitHub:
TIL thanks to a tweet from Devon Govett...
If you add an ID of "test" to an element:
<div id="test"></div>
You can access it using the global variable
test
from JS from the console. Could be
handy for debugging.
Bonus:
Also, incase you dind't know, any highlighted
selected in the "Elements" tab of developer
tools can be accessed directly in the console
with $0
.
🐛 Happy debugging!
Today I Learned that in JavaScript an Array can be truncated by simply setting its length 🤯
Here is an example:
const myArray = [1, 2, 4, 8, 16, 32, 64, 128]
myArray.length = 4
console.log(myArray)
// [1,2,4,8]