Quick JavaScript Tip: Storing unique data using Sets

Published April 13, 2020, 1 min read, tagged as: javascriptcodequick tip

Quick JavaScript Tip: Sets in JavaScript are a great way to store unique values. You can even convert Arrays to Sets to deduplicate them.

const pets = [
	'cat',
	'dog',
	'rabbit',
	'dog',
	'parrot'
]

const uniquePets = new Set(pets) // {'cat', 'dog', 'rabbit', 'parrot'}

I tweet about this type of thing a lot. If you enjoyed this article, you may enjoy following me.

April 17, 2020, 1 min read
javascriptcodequick tip

Quick JavaScript Tip: Emptying an array without losing reference

Quick JavaScript Tip: Overwriting an array's length property gives us an easy way to truncate and clear its content.

Read more

World Class Teams Create World Class Products

A Guide for Tech Leaders Navigating Growth and Change.

I'm writing a book! I share:

  • My framework to define and achieve engineering goals so you can move the needle in your organization and keep everyone rowing in the same direction
  • How to retain top tech talent and build high-performing teams
  • How to release great products rapidly with a structured Software Development Lifecycle (SDLC)
  • How to manage yourself and avoid common pitfalls that challenge many leaders
  • How to manage multiple teams and learn how to manage managers
  • Proven tactics to deliver better customer experience every time, even in fast paced environments

Released September 30, 2020

Subscribe to the mailing list to stay up to date

© 2020 Hashtag Coder
Built with Gatsby