20 Mind Blowing JavaScript Snippets 🤯

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

A thread 🧵👇️
1️⃣ Get Value of a browser Cookie

We can retrieve the value of a stored cookie by accessing with document.cookie.
2️⃣ Convert RGB to Hex

Ever wondered how to convert a RGB color to hex in JavaScript. Worry no more!
3️⃣ Check if array is empty

This simple one liner to check if an array is empty, will return true or false as result.
4️⃣ Find the day of year

Snippet to help you find which is the day by a given date.
5️⃣ Find the number of days between two days

Find the days between 2 given days using the following snippet.
6️⃣ Clear All Browser Cookies

You can easily clear all cookies stored in a web page by accessing the cookie using document.cookie and clearing it.
7️⃣ Get Query Params from URL

You can easily retrieve query params from a url either by passing window.location or the raw URL.
8️⃣ Log Time from Date

We can log time, in the format hour::minutes::seconds from a given date
9️⃣ Check if a number is even or odd

% operator makes it super easy to check if a given number is odd or even.
🔟 Get User Selected Text

One line snippet to grab the text that is currently selected by a user.
See Part 1 for 10 more Fantastic JavaScript Snippets 🔥👇️

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

23 Sep
Free Web Development Resources 👨‍💻

180+ curated free resources for any topic. 99.8% don't know these amazing resources, must read thread!

A Mega Thread 🧵👇️
Free Learning Platforms:

✍️ w3schools.com
✍️ developer.mozilla.org/en-US/
✍️ freecodecamp.org
✍️ guru99.com
✍️ htmldog.com
✍️ geeksforgeeks.org
✍️ sololearn.com/home
✍️ javascript.info
Design Inspiration:

dribbble.com
awwwards.com
✨ https://t.co/F1N0Mr41BF
muz.li
onepagelove.com
collectui.com
land-book.com
mobbin.design/browse/ios/apps
Read 25 tweets
22 Sep
GitHub Repositories to Crush any Programming Interview 🔥

Take advantage of these curated GitHub repo's to land your dream job.

A Thread 🧵👇️
1️⃣ Coding Interview University (⭐️ 190k)

A complete computer science study plan to become a software engineer.

github.com/jwasham/coding… 🔗
2️⃣ Tech Interview Handbook (⭐️ 56.2k)

Curated interview preparation materials for busy engineers

github.com/yangshun/tech-… 🔗
Read 10 tweets
21 Sep
10 Popular Free APIs for Web Developers 🔥

APIs are an essential resource for any web developer. Here are some fantastic APIs for any project.

A thread 🧵👇️
1️⃣ IMDb API

Grab all information about films, actors, characters,etc… as on official websites.

rapidapi.com/apidojo/api/im… 🔗
2️⃣ Open Weather Map API

Get weather and weather forecasts for multiple cities.

rapidapi.com/community/api/… 🔗
Read 13 tweets
20 Sep
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.
Read 12 tweets
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

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!

:(