Roc Tanweer Profile picture
Feb 24 10 tweets 3 min read
💡 JavaScript Tip 💡
Making a 'composition function' becomes much more cleaner✨
#javascript #webdevelopment
Here's how👇
Normally while composing functions, you would do this👇which is okay, but when you are using too many functions, the code become hard to read
Follow these steps👇 to make your composition cleaner and more scalable
Step 1⃣
Install a package called 'lodash' in your project.
run 👇 in your terminal
Step 2⃣
Import the function in your JavaScript file
Do this on top of your file👇
Step 3⃣
Write any two(not necessarily) function:
I'm gonna make functions called 'trim' and 'toLowerCase' 👇
Step 4⃣
Call the 'pipe' function by passing all of your func names in their executing sequence. 'pipe' returns a function which takes the input and passes through the series of function in such a way that the result from first function is passed into the next function
Step 5⃣
Now console log the result. You should see this👇
That's all for now.

If you found this helpful, make sure to

1. Like & Retweet the first tweet so others will also learn

2. Follow @roc_tanweer to see more useful content

See you guys next time👋
Happy Coding🤓

• • •

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

Keep Current with Roc Tanweer

Roc Tanweer 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 @roc_tanweer

Feb 23
💡Git Tip
- What is Alias in #git and why you should know it?
A thread🧵👇
▶️Alias is a term associated with shortcuts in Git.
▶️It compresses longer sequences of commands to make it more meaningful or contain less characters.
Example:
✨Here's how you can make one✨
Open you terminal and type👇
Read 6 tweets
Feb 22
💡#coding tip
Enhance your problem-solving skill by asking Questions.
Here's how👇
1⃣ What information is given in the problem?
- This question will help you to know the problem in depth. You may write bullet points of those info for further reference.
2⃣ What do I know about those information?
- This will help you to know the context of your problem. For instance, the problem may need you to know a mathematical theorem or a programming concept to be solved.
Read 6 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

Don't want to be a Premium member but still want to support us?

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

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(