10 Killer JavaScript Snippets for Web Developers 🔥

One line JavaScript snippets to boost up your productivity. 98.8% people don't know all of them!

A thread 🧵👇️
1️⃣ Capitalise a String

Javascript doesn't have an inbuilt capitalise function, so we can combine charAt and toUpperCase methods for that.
2️⃣ Remove Duplicates from Array

You can easily remove duplicates with Set in JavaScript. Its a life saver.
3️⃣ Find Average of Given Numbers

Find the average between given numbers using reduce method in JavaScript.
4️⃣ Scroll to Top

You can use window.scrollTo(0, 0) method to automatic scroll to top. Set both x and y as 0.
5️⃣ Reverse a string

Combining split, reverse and join methods could create a reverse effect of a string.
6️⃣ Shuffle an Array

Shuffling an array made super easy with sort and random methods.
7️⃣ Detect Dark Mode

Check if a user's device is in dark mode by using "(prefers-color-scheme: dark)" method.
8️⃣ Generate Random Hex Color

You can generate random hex colors with Math.random and padEnd properties.
9️⃣ Check if Date is Valid

Use the following snippet to check if a given date is valid or not.
🔟 Copy to Clipboard

Easily copy any text to clipboard using the navigator.clipboard.writeText property of JavaScript.
If you found this thread helpful, please consider following me @saviomartin7 and retweeting the first tweet.

Thank you so much for your support, friends! 🙏

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Savio Martin ⚡️

Savio Martin ⚡️ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @saviomartin7

19 Sep
20 Killer Websites for Web Developers and Designers 🤯

98.8% don't know these resources. The ultimate list of the best developer tools.

A thread 🧵👇️
gradienta.io 🔗

Create stunning asthetic multicoloured backgrounds in seconds and copy CSS.
fontjoy.com 🔗

Pair your Google fonts with ease. Analyse 100+ fonts and find the best one.
Read 22 tweets
18 Sep
I built my side project moodly.site in 4 hrs and sold it for $2000 within 4 days.

I'm just 14 🤯 Here is my journey 👇️
Just one year ago, I was introduced to web development. I quickly discovered that it is my world. I started learning more about web development and Frontend. I learned React and Next JS as part of Frontend.

I realised that this was my passion and I should stick to it ⚡️
In my opinion, there is no better way to learn than by building. I started with small ones and built my way up.

Soon after, I learned about hackathons and got involved. My achievements include winning 4 hackathons hosted at @hashnode 🎉
Read 10 tweets
8 Sep
You can learn Web Development for FREE.

Here are the best websites to learn Web Development 👨‍💻
(a thread 🧵)
1️⃣ W3schools

Best place to learn web development technologies with exercises and live editor.

w3schools.com 🔗
2️⃣ MDN Web Docs

It is a documentation repository and learning resource for web developers used by Mozilla, Google etc.

developer.mozilla.org/en-US/ 🔗
Read 10 tweets
29 Aug
Googling is a must have skill for developers.

Here are the pro tips to search on Google.
(A thread with examples 🧵)
1️⃣ Asterisk *

Use * to fill missing words or phrases
2️⃣ Search:

Using search: you can search within a website
Read 11 tweets
27 Aug
Most Popular Platforms to Get FREE 3d Illustrations 🔥

(a thread 🧵)
1️⃣ AmritPal Design

In his website you can find all 3D illustrations, 3D design assets, and 3D avatars.

amritpaldesign.com 🔗
2️⃣ Handz-Design

Handz is an amzing 3D illustration library basically made for hand gestures.

handz.design 🔗
Read 12 tweets
25 Aug
You can learn Web Development for FREE now 🔥

Here are the best websites to learn Web Development FREE ✨️
(a thread 🧵)
1️⃣ W3schools

Best place to learn web development technologies with exercises and live editor.

w3schools.com 🔗
2️⃣ MDN Web Docs

It is a documentation repository and learning resource for web developers used by Mozilla, Google etc.

developer.mozilla.org/en-US/ 🔗
Read 10 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(