Top Mistakes I made as a JavaScript Developer...

A Thread...
Today, JavaScript is at the core of virtually all modern web applications.

Let me show you some typical mistakes that almost every JS programmer has made during their career.

I've been a JS dev since 2014 & I still make some of these mistakes, especially when coding in a hurry.
▫ Do you remember the difference between «=», «==» and «===»?

You might encounter a problem with code 👇

You'll get “Hello”! Why?

Because you don’t understand the difference between the 3 operators mentioned above.
Let’s get this thing over with and go further:

“=” is the equal operator, so it’s used for assignment.
In our example, we assign seven to “x” in the condition and get words of welcome “Hello”.

The correct code looks like this:

We get “Nope”.
“==” is the loose equality comparison operator.

Why loose? Because it allows converting values from one type to another to compare them

“===” is the strict equality comparison operator. If this operator returns “true” it means that our values are identical both in value & type.
▫ Inefficient DOM manipulation

JavaScript makes it relatively easy to manipulate the DOM (i.e., add, modify, and remove elements).

A common example is a code that adds a series of DOM Elements one at a time.

Adding a DOM element is an expensive operation.
One effective alternative when multiple DOM elements need to be added is to use document fragments instead, thereby improving both efficiency and performance.
▫ Used '&' when I mean to use '&&'

The 'bitwise' & is used to compare Integers, and if the values being compared are not Integers, they are coerced into Integers.

The standard && is used to compare the truthiness of the operands.
So 123 & false === 0 (because the false becomes a 0)

but 123 && false === false 9 & 5 === 1 but 9 && 5 === 5.

But why does 9 && 5 === 5 and not equal true?

Can you tell me why? Try yourself...
▫ Misunderstand the difference between “let”, “const” and “var”

Let’s first look at the code below:

The code is logical as the output, no questions.
Another example:

The reason is that var is function scoped and let is block scoped.

When you declare a variable with a let keyword, they are moved to the beginning of the block.

This may lead to a reference error when you try to access the variable before the initialization.
▫ Incorrect use of function definitions inside for loops

▫ Fail to notice that 'this' is not always 'this'

▫ Incorrect references to instance methods

▫ Thinking that variables can be scoped to their blocks
▫ Fail to use “strict mode

“strict mode” (i.e., including 'use strict'; at the beginning of your JavaScript source files) is a way to voluntarily enforce stricter parsing and error handling on your JavaScript code at runtime, as well as making it more secure.
Some key benefits of strict mode:

- Makes debugging easier.
- Prevents accidental globals.
- Eliminates this coercion.
- Makes eval() safer.
- Throws error on invalid usage of delete.
In the end,

I would say the better you understand why and how JavaScript works and doesn’t work.

The more solid your code will be...
The more you’ll be able to effectively harness the true power of the language...

Happy coding...
If you’re a beginner at JavaScript and want to learn JavaScript e2e concepts, here’s a great course by WellPaidGeek who is coding for 20+ years?

I highly recommend buying this course.

link if someone is interested. 👇

Use coupon_code=70KSPECIAL

wellpaidgeek.teachable.com/p/beginners-ja…

• • •

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

Keep Current with Ankur💻🎧💪

Ankur💻🎧💪 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 @TheAnkurTyagi

3 Jun
Top 10 Threads Every Developer/Creator/Freelancer
Must Read...

A Thread... Top 10 Threads Every Develo...
1- Copywriting tips to increase conversions by @jmoserr

Read 12 tweets
31 May
How to Hire a Good JavaScript Developer...

A Thread...
As with any technology, there’s knowing JavaScript and then there’s really knowing JavaScript.

Let me share a couple of proven & effective techniques and questions for finding true masters of the language.

Note:
These sample questions are intended merely as a guide.
🚨 Alert 🚨

Not every candidate worth hiring will be able to properly answer them all, nor does answering them all guarantee a candidate.

At the end of the day, hiring remains as much of an art as it does a science.

JS, is in the world of tech today has become fundamental.
Read 13 tweets
30 May
I have gone through many resumes as a developer in my 11+ year of career -- Some common issues I found...

And How you can improve your resume...

A Thread...
I am constantly asked for advice on how to improve resumes in DMs.

While there is no magic method for creating a great document, there are ground rules for how to improve your resume & increase your chances of being contacted by a recruiter or hiring manager.
▫ Don’t make your resume too long.

Recruiters/Interviewers are busy with their daily coding issues while they need to take the interview as well & reviewing dozens of resumes at any given time.

-They don’t have the time to read all lengthy resumes.

-Two page resume is fine.
Read 15 tweets
29 May
Top Strategies for a Successful Job Search as a Software Engineer (Developer)...

A Thread... Image
1: Use Your Network to Find a Job

I know not everyone has a strong network they can rely on. It’s okay.

But whoever you do know, you should talk to and utilize.

And you should make new connections/professional relationships to make your job search easier as well.
▫ Tell Everyone in Your Network

Tell people you’re job hunting.
Nobody can help you if you don’t tell people.

I once landed an interview at a top tech company in Pune by telling my LinkedIn connection which I think not even close one, I was job hunting & rest is history.
Read 19 tweets
2 May
7 uncomfortable truths about being a developer.

A Thread...
1. We have an identity crisis.

I used to be confused about whether I should introduce myself as a developer, software engineer, front-end engineer, back-end engineer, full-stack engineer, a software engineer in a test, or just a freelancer.
The tech market is the market.
It doesn't care about who you are, as a developer.

-Which degree you hold
-What boot camp you completed
-Which Udemy course you did

It's hard-hitting for some devs initially.

Your emotional & mental state as a dev has a direct impact on your work
Read 10 tweets
1 May
Mistakes I made as a software engineer (developer)...

A Thread...
It’s okay to screw up — that’s how you learn and grow. But, be sure to learn from past mistakes.

Every software engineer has their own quirks.
▫ I assumed that documentation is not needed.

Biggest mistake ever.

Create a Wiki/Confluence page for your project and write down everything.
Read 13 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!

:(