Swapna Kumar Panda Profile picture
Jan 31, 2022 β€’ 14 tweets β€’ 4 min read β€’ Read on X
🦾 11 Modern JavaScript Hacks

⇩
πŸ“‹ Table of Contents

➊ Conversion to Number
βž‹ Conversion to Boolean
➌ Conversion to String
➍ Complex String
➎ Short Circuit && / ||
➏ Nullish Check
➐ Default Value
βž‘ Default Function Parameter
βž’ Optional Chaining
βž“ Array Resizing
➊➊ Function Rest Parameter
➊ Conversion to Number

To convert any data to a Number type, use

β‡₯ Unary "+" operator
β‡₯ Number function
β‡₯ parseInt function
βž‹ Conversion to Boolean

To convert any data to a Boolean type, use

β‡₯ Boolean function
β‡₯ !! operator (Double Bang Operator)
➌ Conversion to String

Are you converting a value to a String like below? Remember, it's faulty.

β‡₯ '' + input

Instead use String() function.
➍ Complex String

Are you forming a String using multiple concatenation operators? Remember, it's difficult to write and hard to read.

β‡₯ 'Hello ' + fName + ' ' + lName

The modern approach is to use String Template Literals.

β‡₯ `Hello ${fName} ${lName}'
➎ Short Circuit && / ||

Are you still using "if" statements for one-liners?

β‡₯ if (hungry) eat()

The modern approach in such scenarios is to use Short-Circuits.

β‡₯ hungry && eat()
➏ Nullish Check

How do you check Nullish values?

The modern and most effective way is doing it using "Nullish Coalescing Operator" (??)
➐ Default Value

How do you assign value to a variable if it's missing?

β‡₯ x || (x = 10)
β‡₯ y ?? (y = 10)

The modern approach of doing it is

β‡₯ x ||= 10
β‡₯ y ??= 10
βž‘ Default Function Parameter

Do you often check if a function parameter is missing its value and manually assign a value to it?

The modern approach is to use default function parameters.
βž’ Optional Chaining

To avoid TypeError, instead of checking whether a property exists in an object manually, use "Optional Chaining Operator" (?.)
βž“ Array Resizing

To remove few last elements from an array, simply modify the array's length property value. Items from the array will automatically be removed.
➊➊ Function Rest Parameter

Are you using "arguments" variable to manipulate your function parameters? The modern approach is to use a "rest parameter".
End of 🧡

Are you looking for modern tricks for web development? I am sharing those on HTML/CSS, JavaScript and React regularly.

If you are interested, Follow me βœ…

β€’ β€’ β€’

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

Keep Current with Swapna Kumar Panda

Swapna Kumar Panda 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 @swapnakpanda

Sep 21
If you want to learn Mathematics,

These FIVE channels are more than enough. Image
Image
Image
Image
Read 6 tweets
Sep 20
πŸ‘©β€πŸ’» Practice these 175+ Algorithms in

❍ C/C++
❍ Java
❍ Python
❍ JavaScript
Or, any language of your choice

The quickest way to MASTER the DSA.
➊ Arrays

βž€ Creating an Array
➁ Iterate through Array
βž‚ Get an Element
βžƒ Search an Element
βž„ Insert Element(s)
βž… Delete Element(s)
βž† Filter an Array
βž‡ Fetch a Sub-Array
➈ Merging Arrays
βž‰ Reverse Array
βž€βž€ Rotate Array
βž‹ Linked Lists

βž€ Creating a Linked List
➁ Iterate through Linked List
βž‚ Get an Element
βžƒ Find an Element

➀ Insert Element(s)
βž„ At Start
βž… At End
βž† At Anywhere

➀ Delete Element(s)
βž‡ From Start
➈ From End
βž‰ From Anywhere

βž€βž€ IsEmpty
βž€βž Merging Linked Lists
βž€βž‚ Reverse Linked List
βž€βžƒ Check for Cycles

Implement these algorithms for linked lists, double linked lists, circular linked lists, etc.
Read 20 tweets
Sep 18
FREE FREE FREE

12 FREE Books on AI & ML - from MIT

Absolute Beginner FriendlyImage
Image
Image
Image
1. Foundations of Machine Learning

- A classic book for beginners in ML
- Total 505 Pages

πŸŽ„ cs.nyu.edu/~mohri/mlbook/Image
2. Introduction to Machine Learning Systems

- Authored by Harvard Professor
- 2042 Pages
- Updated in Sep, 2025

πŸŽ„ mlsysbook.ai/assets/downloa…Image
Read 14 tweets
Sep 15
FREE Certifications that are FULLY accepted in the industry:

1. freecodecamp.org/learn/Image
2. University of Helsinki

❯ Python Programming
programming-25.mooc.fi

❯ Data Analysis with Python
courses.mooc.fi/org/uh-cs/cour…

❯ AI
elementsofai.com

❯ DevOps with Kubernetes
devopswithkubernetes.com

❯ Fullstack Web Development
fullstackopen.com

πŸ–‡οΈ All courses: mooc.fi/en/courses/Image
3. Saylor Academy

❯ Database
❯ OS
❯ Networking
❯ Data Science

πŸ–‡οΈ learn.saylor.org/course/index.p…Image
Read 10 tweets
Sep 14
MIT's FREE Courses on AI & ML:

❯ 6.034 : Artificial Intelligence
❯ 6.036 : Machine Learning
❯ 6.S191 : Deep Learning
❯ 18.06 : Linear Algebra
❯ 18.05 : Probability and Statistics
❯ 18.S096 : Matrix Calculus

All links inside:
1. 6.034 - Artificial Intelligence

❯ Course Link
ocw.mit.edu/courses/6-034-…

❯ YouTube Playlist
youtube.com/playlist?list=…Image
Image
2. 6.036 - Machine Learning

❯ Course Link
openlearninglibrary.mit.edu/courses/course…

❯ YouTube Playlist
youtube.com/playlist?list=…Image
Image
Read 8 tweets
Sep 13
Best skills to build in 2025: AI & ML

Here's a complete roadmap w/ all free resources: Image
1. Python

Time: 1 month

Focus on Python programming and basic data structures.

⬙ Detailed Roadmap
x.com/swapnakpanda/s…

β¬— Free Books
❯ Think Python (O'Reilly)
allendowney.github.io/ThinkPython/

❯ Introduction to Programming with Python
aupress.ca/books/oer-2023…

❯ Introduction to Python Programming
assets.openstax.org/oscms-prodcms/…

⬘ Free Course - Harvard CS50
cs50.harvard.edu/python/

β¬– YouTube Courses
❯ MIT Full Course for Beginners
youtube.com/playlist?list=…

❯ Python for Everybody (freeCodeCamp)
youtube.com/watch?v=8Dvywo…Image
2. Mathematics

Time: 2nd & 3rd Month

➀ Key Topics
✩ Linear Algebra
✩ Single and Multivariable Calculus
✩ Probability & Statistics

⬙ Free Books
❯ Mathematics for Machine Learning
mml-book.github.io/book/mml-book.…

❯ Mathematics for Machine Learning (UC Berkeley)
gwthomas.github.io/docs/math4ml.p…

β¬— More Free Books
x.com/swapnakpanda/s…

⬘ Free Course - Khan Academy
❯ Linear Algebra
khanacademy.org/math/linear-al…

❯ Probability & Stats
khanacademy.org/math/statistic…

β¬– YouTube
youtube.com/@JonKrohnLearnsImage
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

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!

:(