r/JavaScriptTips • • Mar 21 '22

USeful VSCode extension

13 Upvotes

Hello everyone,

Here is a list of some useful VSCode extensions which may help in web development.

I hope it will help someone. Also if you know of any other good VSCode extension, Please share it. I would be grateful.

Thanks

https://farhan-tanvir.medium.com/10-useful-vs-code-extensions-to-make-life-easier-%E3%83%BCpart-3-ec0c29b95357


r/JavaScriptTips • • Jun 23 '19

Use Destructuring Syntax to efficiently assign multiple values from an array or object.

Post image
13 Upvotes

r/JavaScriptTips • • Oct 11 '25

πŸ’‘ Small JavaScript Tip: The Subtle Difference Between sort() and sort(callback)

12 Upvotes

Ever used .sort() without a callback and thought it β€œjust works”?
Well… sometimes it does. Sometimes it doesn’t. πŸ˜…

Let’s look at this πŸ‘‡

const users = [
  { name: 'Charlie', age: 28 },
  { name: 'Alice', age: 32 },
  { name: 'Bob', age: 25 },
];

// 1️⃣ Without callback
console.log(users.sort());
// ❌ Unexpected β€” compares stringified objects, not what you want

// 2️⃣ With callback
console.log(users.sort((a, b) => a.name.localeCompare(b.name)));
// βœ… Correct β€” sorts alphabetically by name

πŸ’¬ Key takeaway:
sort() without a callback converts items to strings and compares their Unicode order.
To sort objects properly, always pass a comparator.

Next time you see .sort(), ask yourself β€”
πŸ‘‰ β€œIs JavaScript sorting what I think it’s sorting?”

#JavaScript #WebDevelopment #CodingTips #Frontend #TypeScript


r/JavaScriptTips • • Jan 25 '25

My professor has introduced JavaScript to my current semester, and I'm expected to find out the proper way of making commands for 'console.log' while barely learning its functionality. I'm also unsure what to exactly type in the browser console for testing. Below are instructions and my JS attempts.

Post image
12 Upvotes

r/JavaScriptTips • • Oct 03 '24

Help with understanding how DOM works

Post image
12 Upvotes

r/JavaScriptTips • • Sep 19 '24

Build Robot Toggle in HTML CSS and JavaScript

12 Upvotes

r/JavaScriptTips • • Aug 13 '24

I've curated a list of awesome websites for web developers! check it out!!! πŸ”₯

12 Upvotes

Hey everyone! πŸ‘‹πŸΌ

I've put together aΒ collection of useful websites for web developers, and I'm excited to share it with you all! Whether you're just starting out or you've got years of experience in web development, you'll find something valuable in this repo.

GitHub Repo:Β awesome-webdev-resources

If you know any great websites that aren't included yet, feel free to contribute! πŸš€


r/JavaScriptTips • • Mar 02 '24

3D Hover Effect Using HTML CSS

12 Upvotes

r/JavaScriptTips • • Sep 24 '23

Help with assignment

Post image
12 Upvotes

The break part of this while loop isn’t working. It’s supposed to exit when the user enters 999


r/JavaScriptTips • • Jun 08 '23

Image Captions, Object Detection, Facial Recognition using Javascript

Post image
12 Upvotes

r/JavaScriptTips • • Feb 26 '23

You can keep your main JS file clean by importing with modules

Post image
12 Upvotes

r/JavaScriptTips • • Feb 13 '23

How to serve a website/SPA with API using Node-Express πŸ“βœ¨

Post image
12 Upvotes

r/JavaScriptTips • • Jan 19 '23

How to copy text to clipboard with async/await result-handling

Post image
12 Upvotes

r/JavaScriptTips • • Jan 13 '23

Copying text to clipboard and handling result with async/await πŸ“‹

Post image
12 Upvotes

r/JavaScriptTips • • Nov 28 '22

I can finally write, now tell me how bad it is. I saw a function that could tell is a number was Prime when I first started my JS journey and had no clue what any of it meant at the time. Now that I’ve made my own, tell me how bad it is so I have an idea where my thinking on this needs improvement

Post image
12 Upvotes

r/JavaScriptTips • • Nov 11 '22

Why does JavaScript have both null and undefined?

12 Upvotes

Most programming languages have a single value to indicate the absence of something, which is often called null and is used to represent a variable that has no value associated with it.

But JavaScript is different. Someone who is just starting out with JavaScript or coming from a different language usually finds it hard to understand, why there are two values that indicate absence: null and undefined

Check out the post to learn how these two are different.


r/JavaScriptTips • • Aug 18 '25

Apple-js ( Control Mac-OS with javascript )

Thumbnail gallery
11 Upvotes

r/JavaScriptTips • • Nov 13 '24

Cookie Management πŸͺβ˜•

11 Upvotes

Creating a cookie with users input name

Cookie expiry date

Read the cookies and display value

Deleting a cookie

webdeveloper

javascript #news #memes #instagram

india #coding #brogrammes #coding


r/JavaScriptTips • • Oct 07 '24

Create CSS Text Animation | Text Animation HTML & CSS #html

11 Upvotes

r/JavaScriptTips • • Jun 19 '24

Why Am i getting this error while adding in Javascript ( just a beginner please help )

Thumbnail
gallery
11 Upvotes

i made a small faulty calci app which gives u a wrong answer 10% of the time all the functions work as expected but when i add the numbers instead of the sum it gives me the concatenation of the number instead of 3+4=7 it gives 3+4=34

i have not used any quotes to write the variables and have left enough space

please help me solve the issue and guide me

thank you

( the clip for refrence has been attached with the code )


r/JavaScriptTips • • Mar 09 '24

Creative Image Hover Effects with HTML & CSS

11 Upvotes

r/JavaScriptTips • • Jun 23 '23

Security Alert: Don't `npm install https`

Thumbnail
blog.sandworm.dev
11 Upvotes

r/JavaScriptTips • • Jun 13 '23

πŸš€ Boost your code with the Nullish Coalescing Operator (??) πŸš€

Post image
11 Upvotes

Struggling with null or undefined values? The Nullish Coalescing Operator (??) is here to save the day! πŸ¦Έβ€β™‚οΈ

πŸ”Έ Scenario: You have a variable 'userAge' set to null and want to use its value if it's NOT null or undefined. If it is, you'll use 'defaultAge' instead.

πŸ”Έ Solution: The Nullish Coalescing Operator (??) returns the right-hand side value ('defaultAge') when the left-hand side value ('userAge') is null or undefined.

🌟 Result: No more null or undefined headaches! Your code is now cleaner and more efficient. 🌟

πŸ“£ Share your thoughts and experiences with the Nullish Coalescing Operator in the comments below! Let's learn and grow together! πŸ’ͺ #CodingTips #JavaScript #LinkedInLearning #GrowthHacking


r/JavaScriptTips • • Nov 01 '22

This is why you should not using "toFixed" to rounding a number to the nearest integer.

11 Upvotes

console.log(+(123.455).toFixed(2))

--> The output is 123.45 (wrong)

console.log(Math.round(123.455 * 100) / 100)

--> The output is 123.46 (correct)

-----------------------------------------------------------------------------

Some peoples said "toFixed" is rounding down the number. This is not true.

> +(123.45).toFixed(1)

123.5 (rounding up)

> +(123.445).toFixed(2)

123.44 (rounding down)