Swapna Kumar Panda Profile picture
| Tech Writer, Educator | Python, Java, JavaScript, SQL | DSA, Development | Free Resources, AI Tools | Other Version: @therealswapna | Building @JabardastDEV |

Feb 10, 2022, 11 tweets

25 Utility Code for your next JavaScript Project

➊ Check if input is of number type
➋ Check if input value contains a number
➌ Check if input value is null or, undefined
➍ Check if input value is null or, empty string

➎ Check if input value is falsy
➏ Check if input is an Array
➐ Check if input is an Empty object

➑ Convert first character of each sentence to uppercase
➒ Convert first character of each word to uppercase
➓ Reverse a string
➊➊ Convert a number from one base to another

➊➋ Create and initialise array
➊➌ Empty an array
➊➍ Remove falsy values from an array

➊➎ Remove duplicates from array
➊➏ Casting an array to array of numbers
➊➐ Return a series of integers starting from 0

➊➑ Flatten Array to any depth
➊➒ Remove Holes from Array
➋x➓ Merge any number of arrays
➋➊ Shuffle an array

➋➋ Generate a Random Boolean
➋➌ Generate a Random Number
➋➍ Generate a Random ID
➋➎ Generate a Random Hex Color Code

👉Suggestions👈

⬖ Do you have better implementation for any of these methods? Share those in 💬

⬗ If you find any incorrect information, do inform me.

🚏 Upcoming Twitter Space

📅 12-Feb-2022 (Saturday)
⏰ 07.30PM IST (02.00PM GMT)

⬘ Join me in this space to have some interesting technical discussion around "Arrays and Functions in JavaScript".

⬙ Share among your circle if anyone is interested.

twitter.com/i/spaces/1dRJZ…

End of 🧵

Do you find these utility code useful? I will be sharing more like these for HTML, CSS, JavaScript and React in coming days regularly.

To never miss any, Follow me ✅

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling