Today I Learned - Rocky Kev

TIL Spreading a object into another object

POSTED ON:

TAGS:

Sometimes, I do stuff for a long time and tiny details like this blow me away. This neat trick is one of those times.


const user = {
firstName: "Rocky",
lastName: "Kev"
}

const betterUser = { ...user, superPower: "taking notes" };

See the Pen spread-array-test by rockykev (@rockykev) on CodePen.


Related TILs

Tagged:

TIL Shape-Outside to wrap text

Shape-outside provides a way to customize this wrapping, making it possible to wrap text around complex objects rather than simple boxes.

TIL Math.random() for design tricks

Math.random() is awesome! However, if you dealing with sensitive applications and need a more secure method of randomization, I’d recommend WebCrypto.

TIL How to implement two-way binding without a framework

One of the reasons we use React or Vue is because of that sweet sweet two-way binding. It's the automatic syncing of data between the model (data) and the view (UI) in both directions. Any changes made to the data will automatically update the view, and any changes made to the view will automatically update the data.