Today I Learned - Rocky Kev

Tagged “arrays”

  1. TIL mutations and how to sort without mutating

    Mutation isn't bad. It CAN cause side effects and ruin your life. There's times when you want to have your objects mutate. For everything else, switch to functional programming and passing the data.

  2. TIL a clean way to add classes based on the page in Vue

    If your pages exist in a array, use the includes() to check.

  3. TIL Finds the differences between arrays

    Finds the differences between arrays

  4. TIL find() vs filter()

    `find()` method return the first value which match from the collection. `filter()` method returns the match value from the array.

  5. TIL the history of the for, forEach, and for...of loops

    for loop came first. Then forEach. With new iterables, for...of was adopted.

  6. TIL spreading an array into another array

    So to merge an array, use the spread operator. '...' <-- that guy

  7. TIL a easy way to generate a lot of fake numbers

    You need lots of array elements. You got it.

  8. TIL how NOT to loop through arrays

    Don't use foreach for these use cases

  9. TIL combining PHP arrays

    array_merge, array_replace, and the (+) union operator

  10. TIL use JS filter like a pro

    To remove falsy items, we use `.filter()` `(Array.prototype.filter())`

  11. TIL Using Set and Map

    Differences between Arrays/Set & Objects/Map

See all tags.