Today I Learned - Rocky Kev

Tagged “js”

  1. TIL why you should always use textContent

    Today I learned the difference between 'Node.textContent'. It handles all elements, even hidden ones. It also prevents XSS attacks since it strips tags.

  2. TIL prepend

    When you're creating new elements in Javascript, you want to attach the new element to something that exists in the DOM already. You do that with append, and prepend.

  3. TIL the simulating a Pipe function

    It’s a pipe function that allows you to chain multiple operations together by taking a series of functions as arguments and applying them in a specific order to the input.

  4. TIL Windowing in Browsers

    Windowing only allow you to render what's available. Using twitter as a example, with tweets, when you scroll through hundreds of tweets and inspect the DOM, they just put a bunch of blank space above so there's not like 400 tweets above you.

  5. TIL super()

    When you use super(), it's like you're telling the new object to copy everything from the old object first, and then add or change anything else that's different.

  6. TIL How to check if the string is uppercase

    The magic is comparing str === str.toUpperCase()

  7. TIL how to remove a event listener

    Maybe you have a situation where you only want the event to fire once.

  8. TIL Optional Chaining in PHP8

    Optional Chaining in PHP looks very similar to optional chaining in JS

  9. TIL Object Destructuring

    Object Destructuring -- something you'll see a lot in React & Vue.

  10. TIL the Capitalize String shortcut

    JavaScript doesn’t have a function that allows you to capitalize a string

  11. TIL Deleting Object Properties and Shallow Copy

    Shallow copy objects to safely delete properties

  12. TIL chaining Vue 3 Main.js

    Vue's Main.js file looks slightly different. Here is how to modify it.

  13. TIL how to check if a dom element has a specific class

    How to destructure the classList into an array so you can use include()

  14. TIL Waiting for video to load event listeners

    I discovered the Media Events `loadedmetadata, loadeddata, canplay, canplaythrough`

  15. TIL the JS Library Current Device

    Current Device JS Library lets you target specific devices

See all tags.