brianmp.dev
youtube.com/shorts/WBgI0...
youtube.com/shorts/WBgI0...
`.with()` returns a *copy* of the array instead of modifying it in place! While I think this was the right decision to enforce immutability, I'm still slightly irked that there's still no easy way to do a simple assignment with a negative index.
`.with()` returns a *copy* of the array instead of modifying it in place! While I think this was the right decision to enforce immutability, I'm still slightly irked that there's still no easy way to do a simple assignment with a negative index.
JS also has the `.with()` method that still accepts negative indices! So you can do `myarr.with(-1, 'hello')`
Problem solved! Right?... right?
🙃
JS also has the `.with()` method that still accepts negative indices! So you can do `myarr.with(-1, 'hello')`
Problem solved! Right?... right?
🙃
So something like
`myarr.at(-1) = 'hello'` would result in a Syntax Error
So something like
`myarr.at(-1) = 'hello'` would result in a Syntax Error
This style makes it so much easier to keep a mental model of what your code does.
This style makes it so much easier to keep a mental model of what your code does.
Related code is grouped together such that imports should only go one way. This way, your imports don't seem like a tangled web but more like a DAG.
Related code is grouped together such that imports should only go one way. This way, your imports don't seem like a tangled web but more like a DAG.
So you may have a sales feature with its own code for components, api, and permissions that are not shared by other features.
So you may have a sales feature with its own code for components, api, and permissions that are not shared by other features.