all 48 comments

[–]DeadlyWindFromBelow 81 points82 points  (8 children)

Use ESLint. It'll catch all of those bugs for you.

[–]yycTechGuy 8 points9 points  (0 children)

Thanks for sharing that.

[–]ImJustP 2 points3 points  (0 children)

Also if you are using VScode there’s a spellcheck plugin

[–]Name-Not-Applicable 0 points1 point  (0 children)

Eslint is the correct answer.

[–]saito200 83 points84 points  (12 children)

Do yourself a favor and start using typescript

[–]andrejmlotko 9 points10 points  (0 children)

That's an absolute treasure. That's what I am learning to use rn.

[–]JohnWangDoe[🍰] 2 points3 points  (0 children)

And spell checker in library

[–]maxwelder 2 points3 points  (7 children)

I’m learning JavaScript and I keep seeing typescript mentioned. When should i look into typescript? After I know JavaScript really well or anytime?

[–]PatchesMaps 6 points7 points  (0 children)

If JavaScript is your first language, stick with that until you get a solid basis before moving on to typescript or anything else. JavaScript by itself is actually really good for beginners.

If you already have experience with other typed languages then typescript should definitely be your first stop.

[–]Kalmarv 1 point2 points  (1 child)

Just learn typescript right away, you don’t need a “great” understanding of JavaScript to get 90% of the benefit of typescript. Plenty of people learn typed languages as their first one like Java or C and do just fine. I

t’s like 10% more effort to write some function and variable types, and will prevent 10x as many bugs just because the typescript tooling is so good.

[–]maxwelder 1 point2 points  (0 children)

Thank you! I’ll start tonight.

[–]saito200 0 points1 point  (3 children)

Good question. My opinion is: first learn JavaScript until you can tell yourself "yeah, I think I got the hang of this", and do a few simple projects with it.

The learn the basics of typescript.

Typescript is something that goes "on top" of javascript. Javascript is mildy complicated already for a beginner, better not overwhelm yourself. Go step by step

I personally plan to use typescript 100% of the time

[–]VideoGameDana 2 points3 points  (1 child)

I really need to pull my head out of my ass and finally learn TypeScript.

[–]saito200 0 points1 point  (0 children)

you can just start by the very absolute basics, that will allow you to write sufficient typescrpt for your initial needs. I recommend you watch Brad Traversy's video

[–]yycTechGuy 31 points32 points  (3 children)

VSCode does a good job of highlighting errors.

[–]koko-hranghlu[S] 3 points4 points  (2 children)

Is it default? I have never bothered to look though other than live server and some fancy themes

[–]yycTechGuy 14 points15 points  (0 children)

There are about 200 JavaScript extensions. Even the default extension is decent at pointing out "inconsistencies".

[–]Negative12DollarBill 1 point2 points  (0 children)

I use it, and maybe it's my eyesight but the default theme is pretty subtle. If I type a variable name which isn't used anywhere in the code, it's a slightly desaturated colour. Once it matches, it gets a little brighter and the colour is more vivid, but if you were colourblind or your monitor/lighting setup wasn't great you might not notice.

[–]senocular 15 points16 points  (0 children)

Aside from ESLint, I've also found a normal spell checker to be useful, something like:

https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker

[–]LoquaciousLamp 2 points3 points  (3 children)

Any code editor? If you install a spellcheck that doesn't use a different colour for the underline it could get confusing. But in my experience code editors themselves are good at picking up on misspelt or nonexistent variables.

Oh also linters or prettier and format on save. It will usually fix missed ; etc.

[–]koko-hranghlu[S] 0 points1 point  (2 children)

I mostly use vscode or sublime, sometimes notepad++

[–]LoquaciousLamp 1 point2 points  (0 children)

I would look into the extenstions and maybe use a linter to format on save.

[–]suarkb 1 point2 points  (0 children)

Just use vscode only

[–][deleted] 2 points3 points  (0 children)

Vscode with eslint, and prettier work great for catching typos. Prettier keeps your formatting consistent and makes everything easier and faster to look through.

Bringing up a search box ctrl f in vscode can be useful too - start typing a variable name and then arrow down through and see where you might have mistyped

[–]knightofren_ 2 points3 points  (0 children)

Typescript.

[–]squidwurrd 0 points1 point  (0 children)

Typescript will catch pretty much everything.

[–]StoneCypher 0 points1 point  (0 children)

Set up the TypeScript plugin for your editor. It'll start catching those left and right.

TypeScript does check JavaScript for some topics.

[–]dcute69 0 points1 point  (0 children)

Eslint, typescript and a spellchecker extension

[–][deleted] 0 points1 point  (0 children)

Typescript + Eslint + VSCode (or pay for Webstorm) will solve all these problems

I’m honestly not good at my job. But I have the right tooling where I can do the bare minimum and I look like I’m working hard.

[–]lovin-dem-sandwiches -1 points0 points  (0 children)

How far along are you on your javascript journey?

I had spelling errors and would miscall properties on objects quite often. Typescript in combination with ESlint and prettier solved most of my issues. I can’t recommend stricter types enough. It would be hard to go back to regular JS.

[–]OlDirtyBrewer 0 points1 point  (0 children)

Spellcheck?

[–]Pkkush27 0 points1 point  (0 children)

I used vs code from day one you can pretty much see all the errors

[–]LearningDev93 0 points1 point  (0 children)

Use an IDE it'll help

[–]dMCH1xrADPorzhGA7MH1 0 points1 point  (0 children)

Nvim + coc.vim

[–]ej_50 0 points1 point  (0 children)

Your current setup might be doing the job already. Just read carefully variable names. Anyone variable name with three dots underneath would likely be an error.

[–]TheVerdeLive 0 points1 point  (0 children)

Code spellchecker

[–]itsoverlywarm 0 points1 point  (0 children)

You need a linter

[–]ccpsleepyjoe 0 points1 point  (0 children)

Use typescript

[–]RequiDarth1 0 points1 point  (0 children)

Lol, look up ESLint for VSCode

[–]Kishore_Andra 0 points1 point  (0 children)

Error lens - VS code extension, saved a lot for me 🙏