Copy
Note: You are receiving this because you have signed up for Nordschool's weekly newsletter. Every Monday, we send out our "Better Code Monday" with 3 frontend coding tips from experienced developers.

Better Code Monday 11/11/19

Good day! 👋

Here are this week's three coding tips:

Tip #1 - Shallow or deep?

Copying objects in Javascript can be abit tricky 😅...
Assume we have this kind of object and we would like to copy the data to another object.
If you try to copy it like this, it would create a reference instead of actually copying the data.

Meaning, if we change anything in the greatObject, its copy also gets updated automatically. 😱

Instead you could shallow or deep copy your objects like this....👇
Two ways to shallow copy objects.

Note: This doesn't copy nested objects or arrays but instead creates a reference. Hence the word shallow!
Deep copying object using JSON functions.

Tip #2 - Data-fns ⌛


Are you dealing with dates? Date-fns is a nice little library that could make your life easier.

Here is how it looks like...👇

Tip #3 - Distraction-free environment


At any given moment, there is a million thing fighting for your attention. 😩

To make it easier to focus on the important things, try to minimise the clutter in your digital environment. 🧹

Here are few things I find helpful 😁:
  • Inbox zero, always.
  • Keep Desktop empty.
  • No more than 5 browser tabs open at the time.
  • Use tools like StayFocusd to systematically block noise.
  • Establish notification free-time. No slack, phone notifications or emails...

New Tutorials @Nordschool

Feedback


What kind of tips would you like to receive in the future? I would appreciate it if you would take the time and share any feedback. 😊 

Before you go...


Last thing...support us by sharing the newsletter with someone who you think might benefit or enjoy it. Just hit forward and share with one friend.

That is it folks, wish you a good week & until next time! 👋

Ahmed

If you have been forwarded this email, you are welcome to subscribe here and you will receive next week's tips. 👌
Twitter
Website
Copyright © 2019 Nordschool, All rights reserved.


Want to change how you receive these emails?
You can update your preferences or unsubscribe from this list.

Email Marketing Powered by Mailchimp