Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 4, 2022 09:33 am GMT

Top 3 JavaScript tips I wish someone had told me

Hello World!

After my dev.to tip post got popular, I thought you guys might also enjoy some of my best JavaScript tips. I promise these tips are unique(and not copied from Wikipedia).

Please comment below if you got some tips for me! Learning with you here! Okay, let's get to the juicy bit. Because I don't want to waist your time, I won't get too detailed, but each tip would get it's unique post in the future!

Tip 1 (OOP- Object Oriented Programming)

This is a tip for people planning to have any kind of graphics on their website/application. If you don't fit into that description, consider skipping to the next tip.

Okay, now that 75% of you left this paragraph, let's talk about objects! Basically, to get started, let's make a class.

class reallyadvancedthing{   constructor(x, y){   }   draw(){   }}

Good, now you know some stuff you might not understand. I promise I'll try my best to write a post about JavaScript objects tomorrow. But for today, just stay tuned!

Tip number 2(Comments)

I know, you've probably seen this tip somewhere else, but I am going to get more detailed! Comments help you organise your code, not just for you, but for your fellow developers looking at your code.

You must realise that your code is made to serve the community you're in. You need to help others understand your code's purpose. As Albert Camus once said:

A man without ethics is a wild beast loosed upon this world.

Now let's talk about you. You probably already forgot 90% of what your code does after a few days, and that's not something you want. You don't want to waist those countless hours you spent, at least, add a few basic comments so you know how to use your product!

Tip number 3(Functions)

What's the use of repeating yourself over and over again when you can just use a JavaScript function? JavaScript functions speed up your code and development process.

Trust me, one function can save you an hour, twenty four can save you a whole day of coding, give it a shot!

Conclusion

Hope you enjoy it, as usual, I promise I'll reply to all your questions in the comment section! It'll make my day if you gave this post a like?


Original Link: https://dev.to/freebeliever/top-3-javascript-tips-i-wish-someone-had-told-me-1643

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To