<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rowsan Ali</title>
    <description>The latest articles on DEV Community by Rowsan Ali (@rowsanali).</description>
    <link>https://dev.to/rowsanali</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1185586%2F522a1ca1-55eb-48a8-87ef-92d53e4847f4.png</url>
      <title>DEV Community: Rowsan Ali</title>
      <link>https://dev.to/rowsanali</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rowsanali"/>
    <language>en</language>
    <item>
      <title>What I Wish I Knew Before Using EC2 for the First Time</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Tue, 24 Jun 2025 08:45:52 +0000</pubDate>
      <link>https://dev.to/rowsanali/what-i-wish-i-knew-before-using-ec2-for-the-first-time-fbf</link>
      <guid>https://dev.to/rowsanali/what-i-wish-i-knew-before-using-ec2-for-the-first-time-fbf</guid>
      <description>&lt;p&gt;When I first started using AWS EC2, I thought I was just spinning up a server.&lt;/p&gt;

&lt;p&gt;That’s what most tutorials said.&lt;/p&gt;

&lt;p&gt;Just “launch an instance” and you’re good.&lt;/p&gt;

&lt;p&gt;But what I didn’t know was this: EC2 is simple on the surface, but has a lot of hidden details that can cost you time, money, and sanity.&lt;/p&gt;

&lt;p&gt;Here’s everything I wish someone told me before I used EC2 for the first time — so you can avoid the mistakes I made.&lt;/p&gt;

&lt;p&gt;Join my free newsletter where I write about development and everything in between. &lt;a href="https://acedev.substack.com" rel="noopener noreferrer"&gt;Sign me up.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Choosing the Right Instance Type is Not Optional
&lt;/h3&gt;

&lt;p&gt;The first decision you make is the instance type. You’ll see names like &lt;code&gt;t2.micro&lt;/code&gt;, &lt;code&gt;t3.medium&lt;/code&gt;, &lt;code&gt;m5.large&lt;/code&gt;, and so on.&lt;/p&gt;

&lt;p&gt;Back then, I picked the cheapest one — &lt;code&gt;t2.micro&lt;/code&gt;. Free tier, right?&lt;/p&gt;

&lt;p&gt;But my app kept crashing.&lt;/p&gt;

&lt;p&gt;Why? I didn’t understand how “burstable” instances work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I learned&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;t2.micro&lt;/code&gt; uses &lt;strong&gt;CPU credits&lt;/strong&gt;. You earn credits over time and spend them when your app needs more CPU.&lt;/li&gt;
&lt;li&gt;If you run a long-running process (like a build or script), you can run out of credits fast.&lt;/li&gt;
&lt;li&gt;Once you run out, your instance becomes &lt;strong&gt;very slow&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What to do instead&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you're just experimenting or hosting a static site, &lt;code&gt;t2.micro&lt;/code&gt; is fine.&lt;/li&gt;
&lt;li&gt;If you need something more stable for background tasks, use &lt;code&gt;t3&lt;/code&gt; or &lt;code&gt;m&lt;/code&gt; series.&lt;/li&gt;
&lt;li&gt;Always match the instance to your actual workload — not the price tag.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Security Groups Are Firewalls (And They Matter)
&lt;/h3&gt;

&lt;p&gt;When I launched my EC2 instance, I couldn’t SSH into it.&lt;/p&gt;

&lt;p&gt;I thought it was broken.&lt;/p&gt;

&lt;p&gt;But it was just the &lt;strong&gt;security group&lt;/strong&gt; — EC2’s version of a firewall — blocking my access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I learned&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;By default, EC2 blocks &lt;strong&gt;all&lt;/strong&gt; incoming traffic.&lt;/li&gt;
&lt;li&gt;You have to &lt;strong&gt;manually open ports&lt;/strong&gt;, even for SSH (port 22) or HTTP (port 80).&lt;/li&gt;
&lt;li&gt;If you want to visit your app in a browser, you need to allow port 80 (or 443 for HTTPS).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What to do instead&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When setting up your instance, &lt;strong&gt;add a rule to allow SSH&lt;/strong&gt; from your IP.&lt;/li&gt;
&lt;li&gt;For public websites, allow HTTP and HTTPS.&lt;/li&gt;
&lt;li&gt;Don’t open all ports to the world. That’s asking for trouble.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. EC2 Is Just a Blank Server
&lt;/h3&gt;

&lt;p&gt;When I got into my instance, I typed &lt;code&gt;node&lt;/code&gt; to run my Node app.&lt;/p&gt;

&lt;p&gt;“Command not found.”&lt;/p&gt;

&lt;p&gt;I tried &lt;code&gt;git pull&lt;/code&gt;. That didn’t work either.&lt;/p&gt;

&lt;p&gt;Then it hit me — EC2 is just a &lt;strong&gt;bare OS&lt;/strong&gt;. Nothing comes preinstalled.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I learned&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to install everything: Node, Python, Git, Nginx, whatever.&lt;/li&gt;
&lt;li&gt;There’s no GUI, just a terminal.&lt;/li&gt;
&lt;li&gt;It’s basically like renting a computer from the cloud.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What to do instead&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use a &lt;strong&gt;startup script&lt;/strong&gt; to automate initial setup.&lt;/li&gt;
&lt;li&gt;Or create your own &lt;strong&gt;custom AMI&lt;/strong&gt; once everything is configured the way you want.&lt;/li&gt;
&lt;li&gt;If you’re deploying often, consider using &lt;strong&gt;Elastic Beanstalk&lt;/strong&gt; or &lt;strong&gt;AWS AMI images&lt;/strong&gt; with pre-installed stacks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. EC2 Doesn’t Store Your Data Unless You Tell It To
&lt;/h3&gt;

&lt;p&gt;I once restarted my EC2 instance and all my app files were gone.&lt;/p&gt;

&lt;p&gt;Gone.&lt;/p&gt;

&lt;p&gt;Why? I was using &lt;strong&gt;ephemeral storage&lt;/strong&gt; — which wipes clean on stop/start.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I learned&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EC2 has two main storage types: &lt;strong&gt;Instance Store&lt;/strong&gt; (temporary) and &lt;strong&gt;EBS&lt;/strong&gt; (persistent).&lt;/li&gt;
&lt;li&gt;Only EBS volumes keep your data after shutdown.&lt;/li&gt;
&lt;li&gt;Some AMIs default to instance store unless changed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What to do instead&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Always use EBS for anything important.&lt;/li&gt;
&lt;li&gt;Take &lt;strong&gt;snapshots&lt;/strong&gt; of your volume regularly.&lt;/li&gt;
&lt;li&gt;If you need even more durability, consider storing files on &lt;strong&gt;S3&lt;/strong&gt; instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Public IPs Can Change (Unless You Use Elastic IPs)
&lt;/h3&gt;

&lt;p&gt;I built a nice little app, deployed it on EC2, and sent the IP to my friends.&lt;/p&gt;

&lt;p&gt;A few days later, they said it wasn’t working.&lt;/p&gt;

&lt;p&gt;I checked. The public IP had changed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I learned&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EC2 assigns a &lt;strong&gt;new public IP every time you stop and start&lt;/strong&gt; the instance.&lt;/li&gt;
&lt;li&gt;If you want a stable IP, you must use an &lt;strong&gt;Elastic IP&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What to do instead&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to EC2 &amp;gt; Elastic IPs and allocate one.&lt;/li&gt;
&lt;li&gt;Associate it with your instance.&lt;/li&gt;
&lt;li&gt;Update your DNS or use this IP in your frontend code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: You’ll be charged for unused Elastic IPs, so release them when not needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. SSH Key Pairs Are Everything
&lt;/h3&gt;

&lt;p&gt;You can’t just log in with a password.&lt;/p&gt;

&lt;p&gt;When you launch your instance, AWS asks for a &lt;strong&gt;key pair&lt;/strong&gt; — that &lt;code&gt;.pem&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;I deleted mine thinking I didn’t need it again.&lt;/p&gt;

&lt;p&gt;Big mistake.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I learned&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Without the &lt;code&gt;.pem&lt;/code&gt; file, you can’t SSH into the instance.&lt;/li&gt;
&lt;li&gt;If you lose it, you’ll need to create a new instance or use a snapshot workaround.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What to do instead&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Store your key securely.&lt;/li&gt;
&lt;li&gt;Never delete it unless you're 100% done with the instance.&lt;/li&gt;
&lt;li&gt;Use a password manager or secure backup tool.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. You Need to Set Up Auto Shutdown or You’ll Forget
&lt;/h3&gt;

&lt;p&gt;I once left an EC2 instance running for a month.&lt;/p&gt;

&lt;p&gt;Didn’t even realize it.&lt;/p&gt;

&lt;p&gt;Until the bill came.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I learned&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EC2 charges &lt;strong&gt;by the second&lt;/strong&gt;, but only while the instance is running.&lt;/li&gt;
&lt;li&gt;There's no warning or reminder if something stays running.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What to do instead&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set a calendar reminder to stop unused instances.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;AWS Budgets&lt;/strong&gt; to get alerts on spend.&lt;/li&gt;
&lt;li&gt;You can also set up a &lt;strong&gt;Lambda function&lt;/strong&gt; to auto-stop idle EC2 instances.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  8. EC2 Is Powerful, But Not Always the Best Choice
&lt;/h3&gt;

&lt;p&gt;If you're just trying to host a static website, EC2 is overkill.&lt;/p&gt;

&lt;p&gt;Same if you don’t want to manage Linux.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I learned&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EC2 gives you full control — which means full responsibility.&lt;/li&gt;
&lt;li&gt;For simpler use cases, AWS offers easier tools:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amplify&lt;/strong&gt; for frontend apps&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Elastic Beanstalk&lt;/strong&gt; for managed backends&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lightsail&lt;/strong&gt; for WordPress or quick server setup&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lambda&lt;/strong&gt; for serverless tasks&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What to do instead&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Think about what you actually need.&lt;/li&gt;
&lt;li&gt;If you're just testing something, EC2 is fine.&lt;/li&gt;
&lt;li&gt;But don’t force yourself to manage infrastructure unless it makes sense.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;EC2 is a powerful tool. But like most AWS services, it assumes you know what you’re doing.&lt;/p&gt;

&lt;p&gt;The documentation doesn’t always make things simple.&lt;/p&gt;

&lt;p&gt;And one small setting can lead to hours of debugging or unexpected costs.&lt;/p&gt;

&lt;p&gt;But once you understand the basics — instances, IPs, storage, firewalls — EC2 starts to make sense.&lt;/p&gt;

&lt;p&gt;It becomes a tool you can rely on.&lt;/p&gt;

&lt;p&gt;Just remember: treat EC2 like a real server. Because that’s exactly what it is.&lt;/p&gt;

&lt;p&gt;And a little preparation will save you a lot of pain later.&lt;/p&gt;

&lt;p&gt;Join my free newsletter where I write about development and everything in between. &lt;a href="https://acedev.substack.com" rel="noopener noreferrer"&gt;Sign me up.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>productivity</category>
      <category>discuss</category>
      <category>cloud</category>
    </item>
    <item>
      <title>How I Used AWS CloudFront to Make My Site 2x Faster Globally</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Tue, 24 Jun 2025 08:44:35 +0000</pubDate>
      <link>https://dev.to/rowsanali/how-i-used-aws-cloudfront-to-make-my-site-2x-faster-globally-2lcj</link>
      <guid>https://dev.to/rowsanali/how-i-used-aws-cloudfront-to-make-my-site-2x-faster-globally-2lcj</guid>
      <description>&lt;p&gt;There was a time when I thought a fast server meant a fast site.&lt;/p&gt;

&lt;p&gt;But I was wrong.&lt;/p&gt;

&lt;p&gt;No matter how optimized my code was, users from Europe or Asia were seeing slow load times.&lt;/p&gt;

&lt;p&gt;Meanwhile, everything loaded fine for me—because my server was in the same country.&lt;/p&gt;

&lt;p&gt;So I started digging.&lt;/p&gt;

&lt;p&gt;That’s when I found the real bottleneck: &lt;strong&gt;distance.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The solution?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS CloudFront.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It didn’t just improve my load times—it cut them in half for users worldwide.&lt;/p&gt;

&lt;p&gt;Join my free newsletter where I write about development and everything in between. &lt;a href="https://acedev.substack.com" rel="noopener noreferrer"&gt;Sign me up.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s exactly how I did it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Understanding the Problem
&lt;/h2&gt;

&lt;p&gt;My site was hosted on an EC2 instance in Virginia (us-east-1).&lt;/p&gt;

&lt;p&gt;Great performance in the US.&lt;/p&gt;

&lt;p&gt;Terrible everywhere else.&lt;/p&gt;

&lt;p&gt;When a visitor in Germany loaded my homepage, the request had to travel across the ocean.&lt;/p&gt;

&lt;p&gt;It wasn’t the server—it was the trip.&lt;/p&gt;

&lt;p&gt;Even with gzip, cache control, and image optimization, I was still losing 2–4 seconds on initial page load.&lt;/p&gt;

&lt;p&gt;Not ideal if you care about bounce rate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: What Is CloudFront?
&lt;/h2&gt;

&lt;p&gt;CloudFront is AWS’s Content Delivery Network (CDN).&lt;/p&gt;

&lt;p&gt;It distributes your static (and even dynamic) content across 300+ edge locations around the world.&lt;/p&gt;

&lt;p&gt;When a user visits your site, CloudFront serves content from the &lt;strong&gt;nearest edge server&lt;/strong&gt;, not your origin server.&lt;/p&gt;

&lt;p&gt;That means fewer miles traveled, faster response times.&lt;/p&gt;

&lt;p&gt;It also caches content intelligently, reducing backend load.&lt;/p&gt;

&lt;p&gt;Perfect for image-heavy websites, SPAs, or any site that serves repeat traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Preparing My Content for CloudFront
&lt;/h2&gt;

&lt;p&gt;Before using CloudFront, I made sure my site had:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Static assets&lt;/strong&gt; stored on S3 (images, CSS, JS)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTML files&lt;/strong&gt; deployed via S3 (my site was static, but this works with EC2 or other backends too)&lt;/li&gt;
&lt;li&gt;Correct &lt;strong&gt;Content-Type&lt;/strong&gt; headers on files (important for caching)&lt;/li&gt;
&lt;li&gt;Proper &lt;strong&gt;Cache-Control&lt;/strong&gt; metadata set on S3 objects (so CloudFront knows what to cache and for how long)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without these, CloudFront would still work—but not well.&lt;/p&gt;

&lt;p&gt;Bad headers = no cache = no performance win.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Creating a CloudFront Distribution
&lt;/h2&gt;

&lt;p&gt;Here’s exactly how I set it up:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Opened AWS Console &amp;gt; CloudFront&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Clicked &lt;strong&gt;“Create Distribution”&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Origin Domain&lt;/strong&gt;, I selected my S3 bucket (the one hosting my site)&lt;/li&gt;
&lt;li&gt;Left &lt;strong&gt;Origin Path&lt;/strong&gt; empty (since I wanted to serve the whole bucket)&lt;/li&gt;
&lt;li&gt;Set &lt;strong&gt;Viewer Protocol Policy&lt;/strong&gt; to “Redirect HTTP to HTTPS”&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Default Cache Behavior&lt;/strong&gt;, I enabled:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Caching based on headers&lt;/strong&gt;: None (to improve cache hits)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compress objects automatically&lt;/strong&gt;: Yes&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;Price Class&lt;/strong&gt;, I chose “Use all edge locations” for maximum global reach&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Lastly, I created the distribution.&lt;/p&gt;

&lt;p&gt;It took about 15 minutes to deploy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Connecting My Domain
&lt;/h2&gt;

&lt;p&gt;CloudFront gives you a default domain like &lt;code&gt;d1234.cloudfront.net&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Not great for production.&lt;/p&gt;

&lt;p&gt;To use my custom domain (&lt;code&gt;www.mysite.com&lt;/code&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I went to &lt;strong&gt;Route 53&lt;/strong&gt; (or your DNS provider)&lt;/li&gt;
&lt;li&gt;Created a &lt;strong&gt;CNAME&lt;/strong&gt; record pointing &lt;code&gt;www.mysite.com&lt;/code&gt; to my CloudFront domain&lt;/li&gt;
&lt;li&gt;In CloudFront, under &lt;strong&gt;Alternate Domain Names (CNAMEs)&lt;/strong&gt;, I added &lt;code&gt;www.mysite.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Set up an &lt;strong&gt;SSL certificate&lt;/strong&gt; in ACM (Amazon Certificate Manager) for my domain&lt;/li&gt;
&lt;li&gt;Linked it in the CloudFront distribution&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After that, my domain worked through CloudFront—securely, globally, and fast.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Measuring the Results
&lt;/h2&gt;

&lt;p&gt;I didn’t just want to “feel” the difference.&lt;/p&gt;

&lt;p&gt;I wanted proof.&lt;/p&gt;

&lt;p&gt;So I ran tests using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Google PageSpeed Insights&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WebPageTest.org&lt;/strong&gt; (with servers in Asia and Europe)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lighthouse in Chrome DevTools&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Before CloudFront (Germany test server):
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Time to First Byte (TTFB): ~900ms&lt;/li&gt;
&lt;li&gt;Full load: ~3.5 seconds&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  After CloudFront:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;TTFB: ~200ms&lt;/li&gt;
&lt;li&gt;Full load: ~1.6 seconds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s more than 2x faster.&lt;/p&gt;

&lt;p&gt;And in some regions, it was even faster than that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Fine-Tuning the Cache Behavior
&lt;/h2&gt;

&lt;p&gt;After a week, I noticed some files weren’t updating as expected.&lt;/p&gt;

&lt;p&gt;Turns out I had set a &lt;strong&gt;long cache duration&lt;/strong&gt; on JavaScript files.&lt;/p&gt;

&lt;p&gt;To fix this, I:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Updated S3 object metadata to use &lt;code&gt;Cache-Control: max-age=3600, must-revalidate&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;In CloudFront, created &lt;strong&gt;cache behaviors&lt;/strong&gt; to set different rules for:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/index.html&lt;/code&gt; → short cache (1 minute)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/static/*&lt;/code&gt; → long cache (1 month)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Enabled &lt;strong&gt;Invalidations&lt;/strong&gt; when I pushed updates (can be done via CLI too)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This gave me the best of both worlds:&lt;/p&gt;

&lt;p&gt;Fast caching + flexibility to update content when needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You Should Know Before Using CloudFront
&lt;/h2&gt;

&lt;p&gt;Here are a few simple lessons I learned:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use S3 + CloudFront&lt;/strong&gt; if you’re serving a static site. It’s cheap and reliable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Always configure headers&lt;/strong&gt;. Without correct &lt;code&gt;Content-Type&lt;/code&gt; and &lt;code&gt;Cache-Control&lt;/code&gt;, performance gains drop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CloudFront logs&lt;/strong&gt; are a goldmine. Use them to see where your traffic comes from and what’s being cached.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Invalidate carefully&lt;/strong&gt;. CloudFront invalidation is powerful, but avoid frequent full-path invalidations—they cost money and time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Price class matters&lt;/strong&gt;. If your traffic is mostly in one region, use a regional edge setting to reduce costs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;You don’t need a complex backend to go global.&lt;/p&gt;

&lt;p&gt;You don’t need 10 engineers or a $10K/month CDN.&lt;/p&gt;

&lt;p&gt;What you need is a clear understanding of where your performance is breaking—and a simple tool to fix it.&lt;/p&gt;

&lt;p&gt;For me, that was AWS CloudFront.&lt;/p&gt;

&lt;p&gt;It let me serve my site faster, everywhere, without changing a single line of code.&lt;/p&gt;

&lt;p&gt;The results were real.&lt;/p&gt;

&lt;p&gt;The difference was visible.&lt;/p&gt;

&lt;p&gt;And the setup? Just a few clicks.&lt;/p&gt;

&lt;p&gt;If you’re running a public-facing site and haven’t used CloudFront yet, you’re leaving speed on the table.&lt;/p&gt;

&lt;p&gt;Join my free newsletter where I write about development and everything in between. &lt;a href="https://acedev.substack.com" rel="noopener noreferrer"&gt;Sign me up.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>devops</category>
      <category>aws</category>
    </item>
    <item>
      <title>10 JavaScript Tricks Every Developer Should Know</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Wed, 16 Apr 2025 12:42:14 +0000</pubDate>
      <link>https://dev.to/rowsanali/10-javascript-tricks-every-developer-should-know-4oed</link>
      <guid>https://dev.to/rowsanali/10-javascript-tricks-every-developer-should-know-4oed</guid>
      <description>&lt;p&gt;Most developers use JavaScript every day.&lt;/p&gt;

&lt;p&gt;But few know the small tricks that make a big difference.&lt;/p&gt;

&lt;p&gt;Here are 10 simple but powerful JavaScript tips that can help you write cleaner, smarter code.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Optional Chaining (&lt;code&gt;?.&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Access deeply nested values without breaking your code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Alex&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 30&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// undefined (no error)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it matters&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You don’t need to keep writing &lt;code&gt;if&lt;/code&gt; statements or &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; chains. It just works.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. &lt;strong&gt;Nullish Coalescing (&lt;code&gt;??&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A better way to set fallback values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Default&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "" (not "Default")&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it's better&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
It only falls back if the value is &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;, not falsy like &lt;code&gt;""&lt;/code&gt; or &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  3. &lt;strong&gt;Short-Circuit Evaluation&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Run code only if a condition is true.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;isLoggedIn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;isLoggedIn&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Welcome back!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cleaner than:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isLoggedIn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Welcome back!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. &lt;strong&gt;Destructuring Objects and Arrays&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Extract values in one line.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sarah&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;first&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;second&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it helps&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Less code. More clarity.&lt;/p&gt;
&lt;h3&gt;
  
  
  5. &lt;strong&gt;Default Function Parameters&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;No more manual checks inside functions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Guest&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Hello, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Hello, Guest&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. &lt;strong&gt;Template Literals&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Build strings without the messy &lt;code&gt;+&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`My name is &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; and I am &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; years old.`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  7. &lt;strong&gt;Spread and Rest Operators&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Combine or split data easily.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newArr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// 6&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  8. &lt;strong&gt;Object Property Shorthand&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Cleaner object definitions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Liam&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  9. &lt;strong&gt;Array &lt;code&gt;.at()&lt;/code&gt; Method&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Access items by position, including negatives.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;letters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;d&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;letters&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;at&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// "d"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why use it&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
It’s clearer than &lt;code&gt;arr[arr.length - 1]&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  10. &lt;strong&gt;Double Bitwise NOT for Floor&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Fast alternative to &lt;code&gt;Math.floor()&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;~~&lt;/span&gt;&lt;span class="mf"&gt;4.9&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 4&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;~~-&lt;/span&gt;&lt;span class="mf"&gt;4.9&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// -4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Caution:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Only works well with positive or simple floats. Avoid with big numbers or decimals you care about.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thought&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Great code isn’t just about knowing &lt;em&gt;how&lt;/em&gt; something works.&lt;/p&gt;

&lt;p&gt;It’s about knowing &lt;em&gt;when&lt;/em&gt; to use it — and using it wisely.&lt;/p&gt;

&lt;p&gt;These tricks won’t make you a 10x dev overnight.&lt;/p&gt;

&lt;p&gt;But they’ll help you write code that’s easier to read, easier to debug, and harder to mess up.&lt;/p&gt;

&lt;p&gt;And that’s a great place to start.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>5 core software design principles every developer should know (with examples).</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Mon, 07 Apr 2025 10:10:23 +0000</pubDate>
      <link>https://dev.to/rowsanali/5-core-software-design-principles-every-developer-should-know-with-examples-pjp</link>
      <guid>https://dev.to/rowsanali/5-core-software-design-principles-every-developer-should-know-with-examples-pjp</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F70wfu8zxwn1zrd4w6fxc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F70wfu8zxwn1zrd4w6fxc.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
Good software design is essential for creating systems that are maintainable, scalable, and easy to understand. Here are five core software design principles that every developer should know:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Single Responsibility Principle&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Single Responsibility Principle states that a class should have only one reason to change. This means that a class should have only one responsibility or functionality. If a class has multiple responsibilities, it can lead to tight coupling and make it difficult to modify or extend the class.&lt;/p&gt;

&lt;p&gt;For example, consider a class called “User” that has methods for authentication, data storage, and logging. This class has multiple responsibilities and can be difficult to maintain. Instead, you could break this class into separate classes, each with a single responsibility, such as “Authenticator”, “DataStore”, and “Logger”.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open-Closed Principle&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Open-Closed Principle states that a class should be open for extension but closed for modification. This means that you should be able to add new functionality to a class without modifying its existing code. This principle helps to ensure that changes to a class do not break existing functionality.&lt;/p&gt;

&lt;p&gt;For example, consider a class called “PaymentGateway” that supports multiple payment methods, such as credit cards and PayPal. Instead of modifying the existing class to add a new payment method, you could create a new class that inherits from the “PaymentGateway” class and adds the new payment method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Liskov Substitution Principle&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Liskov Substitution Principle states that subtypes should be substitutable for their base types. This means that any code that uses a base type should be able to work with a subtype without knowing the difference. This principle helps to ensure that inheritance is used correctly and that subtypes are truly substitutable for their base types.&lt;/p&gt;

&lt;p&gt;For example, consider a class called “Vehicle” and a subclass called “Car”. The “Car” class should be substitutable for the “Vehicle” class, meaning that any code that uses a “Vehicle” object should be able to work with a “Car” object without knowing the difference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interface Segregation Principle&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Interface Segregation Principle states that clients should not be forced to depend on interfaces they do not use. This means that a class should not be forced to implement an interface that has methods it does not need. Instead, the interface should be broken down into smaller, more focused interfaces that are specific to the needs of each client.&lt;/p&gt;

&lt;p&gt;For example, consider an interface called “Printable” that has methods for printing, scanning, and faxing. A class that only needs to print documents should not be forced to implement the “Printable” interface, which includes methods for scanning and faxing. Instead, the “Printable” interface could be broken down into separate interfaces, such as “Printable”, “Scannable”, and “Faxable”.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dependency Inversion Principle&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Dependency Inversion Principle states that high-level modules should not depend on low-level modules, but both should depend on abstractions. This means that a high-level module should not be tightly coupled to a specific low-level module, but instead should depend on an abstraction that defines the interface for the low-level module.&lt;/p&gt;

&lt;p&gt;For example, consider a class called “Logger” that depends on a specific logging framework, such as Log4j. Instead of tightly coupling the “Logger” class to Log4j, you could define an abstraction, such as a “Logging” interface, that defines the logging methods. The “Logger” class can then depend on the “Logging” interface, which can be implemented by different logging frameworks, such as Log4j or Logback.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>discuss</category>
      <category>learning</category>
    </item>
    <item>
      <title>Responsive Design Confusion. How to fix it?</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Thu, 20 Mar 2025 07:12:04 +0000</pubDate>
      <link>https://dev.to/rowsanali/responsive-design-confusion-how-to-fix-it-4mg5</link>
      <guid>https://dev.to/rowsanali/responsive-design-confusion-how-to-fix-it-4mg5</guid>
      <description>&lt;p&gt;Responsive design is a cornerstone of modern web development. With the proliferation of devices of all shapes and sizes, ensuring that your website looks great and functions well on every screen is no longer optional—it's essential. However, one of the most challenging aspects of responsive design is managing breakpoints. Breakpoints are the points at which your website's content and design adapt to different screen sizes. Keeping track of these breakpoints can quickly become overwhelming, especially as the number of devices and screen resolutions continues to grow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" alt="Image description" width="800" height="464"&gt;&lt;/a&gt;&lt;br&gt;
If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this blog post, we'll explore the challenges of managing breakpoints in responsive design, and we'll provide practical tips and code examples to help you keep track of them more effectively.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Are Breakpoints?
&lt;/h2&gt;

&lt;p&gt;Breakpoints are specific screen widths at which your website's layout changes to accommodate different screen sizes. For example, you might have a breakpoint at 768px, where the layout shifts from a single-column design on mobile devices to a multi-column design on tablets.&lt;/p&gt;

&lt;p&gt;Here's a simple example of how breakpoints are used in CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Default styles for mobile devices */&lt;/span&gt;
&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Styles for tablets (768px and up) */&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;768px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;750px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Styles for desktops (1024px and up) */&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1024px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;980px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;code&gt;.container&lt;/code&gt; element has different widths and padding depending on the screen size. The &lt;code&gt;@media&lt;/code&gt; rule is used to apply different styles at different breakpoints.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Challenge of Managing Breakpoints
&lt;/h2&gt;

&lt;p&gt;While the concept of breakpoints is straightforward, managing them can be challenging for several reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Proliferation of Devices&lt;/strong&gt;: With new devices being released constantly, each with different screen sizes and resolutions, it's difficult to know which breakpoints to target.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design Complexity&lt;/strong&gt;: As designs become more complex, the number of breakpoints required to accommodate different layouts increases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maintenance&lt;/strong&gt;: Keeping track of breakpoints across multiple CSS files or components can be cumbersome, especially in large projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inconsistency&lt;/strong&gt;: Without a clear strategy, breakpoints can become inconsistent, leading to a disjointed user experience.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Strategies for Managing Breakpoints
&lt;/h2&gt;

&lt;p&gt;To overcome these challenges, it's important to adopt a systematic approach to managing breakpoints. Here are some strategies to help you keep track of them more effectively:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Use a Mobile-First Approach
&lt;/h3&gt;

&lt;p&gt;A mobile-first approach involves designing for mobile devices first and then progressively enhancing the design for larger screens. This approach simplifies the process of managing breakpoints because you start with the smallest screen size and add breakpoints as needed for larger screens.&lt;/p&gt;

&lt;p&gt;Here's an example of a mobile-first approach in CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Default styles for mobile devices */&lt;/span&gt;
&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Styles for tablets (768px and up) */&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;768px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;750px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Styles for desktops (1024px and up) */&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1024px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;980px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the default styles are applied to mobile devices, and additional styles are added for tablets and desktops using &lt;code&gt;min-width&lt;/code&gt; media queries.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Define Breakpoints in a Centralized Location
&lt;/h3&gt;

&lt;p&gt;To maintain consistency and make it easier to manage breakpoints, define them in a centralized location. This could be a CSS file, a Sass/SCSS file, or even a JavaScript file if you're using a CSS-in-JS solution.&lt;/p&gt;

&lt;p&gt;Here's an example of defining breakpoints in a Sass file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="c1"&gt;// _breakpoints.scss&lt;/span&gt;
&lt;span class="nv"&gt;$breakpoints&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s1"&gt;'small'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;576px&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'medium'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;768px&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'large'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;992px&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'xlarge'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1200px&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;respond-to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$breakpoint&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@if&lt;/span&gt; &lt;span class="nf"&gt;map-has-key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$breakpoints&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$breakpoint&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;map-get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$breakpoints&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$breakpoint&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;@content&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;@else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;@warn&lt;/span&gt; &lt;span class="s2"&gt;"Unknown breakpoint: &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$breakpoint&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can then use this mixin in your styles:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;respond-to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'medium'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;750px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;respond-to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'large'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;980px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By defining breakpoints in a centralized location, you can easily update them across your entire project.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Use CSS Custom Properties (Variables)
&lt;/h3&gt;

&lt;p&gt;CSS custom properties (also known as CSS variables) can be used to define breakpoints and make them easier to manage. This approach is particularly useful if you want to dynamically change breakpoints based on user preferences or other conditions.&lt;/p&gt;

&lt;p&gt;Here's an example of using CSS custom properties for breakpoints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;--breakpoint-small&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;576px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--breakpoint-medium&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;768px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--breakpoint-large&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;992px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--breakpoint-xlarge&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1200px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--breakpoint-medium&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;750px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--breakpoint-large&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;980px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using CSS custom properties allows you to easily update breakpoints by changing the values in the &lt;code&gt;:root&lt;/code&gt; selector.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Leverage CSS Frameworks
&lt;/h3&gt;

&lt;p&gt;Many CSS frameworks, such as Bootstrap, Foundation, and Tailwind CSS, come with predefined breakpoints. These frameworks can save you time and effort by providing a consistent set of breakpoints that you can use across your project.&lt;/p&gt;

&lt;p&gt;For example, Bootstrap defines the following breakpoints:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extra small (xs): &amp;lt;576px&lt;/li&gt;
&lt;li&gt;Small (sm): ≥576px&lt;/li&gt;
&lt;li&gt;Medium (md): ≥768px&lt;/li&gt;
&lt;li&gt;Large (lg): ≥992px&lt;/li&gt;
&lt;li&gt;Extra large (xl): ≥1200px&lt;/li&gt;
&lt;li&gt;Extra extra large (xxl): ≥1400px&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's an example of using Bootstrap's breakpoints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"row"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"col-12 col-md-6 col-lg-4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Content goes here&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;code&gt;col-12&lt;/code&gt; class ensures that the column takes up the full width on extra small screens, while &lt;code&gt;col-md-6&lt;/code&gt; and &lt;code&gt;col-lg-4&lt;/code&gt; adjust the column width for medium and large screens, respectively.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Use JavaScript to Dynamically Adjust Breakpoints
&lt;/h3&gt;

&lt;p&gt;In some cases, you may need to dynamically adjust breakpoints based on user interactions or other conditions. JavaScript can be used to achieve this by adding or removing CSS classes or styles based on the screen size.&lt;/p&gt;

&lt;p&gt;Here's an example of using JavaScript to dynamically adjust breakpoints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;container&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.container&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;updateLayout&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerWidth&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;768&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;container&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tablet-layout&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;container&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tablet-layout&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;resize&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;updateLayout&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;updateLayout&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Initial call to set the layout&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;code&gt;updateLayout&lt;/code&gt; function adds or removes the &lt;code&gt;tablet-layout&lt;/code&gt; class based on the screen width. The &lt;code&gt;resize&lt;/code&gt; event listener ensures that the layout is updated whenever the window is resized.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" alt="Image description" width="800" height="464"&gt;&lt;/a&gt;&lt;br&gt;
If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Managing breakpoints in responsive design can be overwhelming, but with the right strategies and tools, you can keep track of them more effectively. By adopting a mobile-first approach, defining breakpoints in a centralized location, using CSS custom properties, leveraging CSS frameworks, and using JavaScript to dynamically adjust breakpoints, you can create a more consistent and maintainable responsive design.&lt;/p&gt;

&lt;p&gt;Remember, the key to successful responsive design is not just about adding breakpoints—it's about creating a seamless user experience across all devices. By keeping your breakpoints organized and consistent, you'll be well on your way to achieving that goal.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What I Wish I Knew Before Learning Frontend Development</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Sat, 08 Mar 2025 11:40:54 +0000</pubDate>
      <link>https://dev.to/rowsanali/what-i-wish-i-knew-before-learning-frontend-development-kl5</link>
      <guid>https://dev.to/rowsanali/what-i-wish-i-knew-before-learning-frontend-development-kl5</guid>
      <description>&lt;p&gt;When I first started learning frontend development, I thought it was all about making websites look good. I imagined tweaking colors, adjusting fonts, and arranging layouts. But as I dove deeper, I quickly realized how much more there was to it. If I could go back, here’s what I wish I had known before starting my frontend journey.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" alt="Image description" width="800" height="464"&gt;&lt;/a&gt;&lt;br&gt;
If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;HTML, CSS, and JavaScript Are Just the Beginning&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;When you start learning frontend development, it feels like mastering HTML, CSS, and JavaScript is enough. But the reality is, these are just the foundation. Once you grasp the basics, you’ll need to learn frameworks, libraries, build tools, and best practices.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CSS alone is not enough—you’ll likely use a preprocessor like SASS or a utility framework like Tailwind CSS.&lt;/li&gt;
&lt;li&gt;JavaScript is powerful, but learning React, Vue, or Angular becomes essential for building complex applications.&lt;/li&gt;
&lt;li&gt;Managing state is a skill on its own, and tools like Redux, Zustand, or React Context make a huge difference.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If I had known this earlier, I would have structured my learning more efficiently instead of jumping between random tutorials.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;You Can’t Ignore JavaScript&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Many beginners avoid JavaScript because it seems complicated. I did the same. I focused too much on HTML and CSS, thinking I could add JavaScript later. That was a mistake.&lt;/p&gt;

&lt;p&gt;Frontend development is heavily JavaScript-driven. Even CSS animations and interactivity often require JavaScript. The sooner you become comfortable with JavaScript, the smoother your journey will be.&lt;/p&gt;

&lt;p&gt;Some key JavaScript concepts that helped me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understanding &lt;strong&gt;closures, promises, and async/await&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Mastering &lt;strong&gt;DOM manipulation and event handling&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Learning &lt;strong&gt;how JavaScript frameworks work under the hood&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don’t delay JavaScript—it’s the backbone of modern frontend development.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Responsive Design Is Not Optional&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;At first, I built websites that looked great on my screen. But the moment I tested them on a phone or tablet, everything broke.&lt;/p&gt;

&lt;p&gt;Responsive design is &lt;strong&gt;not just a feature—it’s a necessity&lt;/strong&gt;. Users visit websites from different devices, and if your site isn’t mobile-friendly, it’s a bad experience.&lt;/p&gt;

&lt;p&gt;Things that helped me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Flexbox and CSS Grid&lt;/strong&gt;: The two most powerful layout tools in CSS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Media queries&lt;/strong&gt;: Controlling how your design adapts to different screen sizes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mobile-first approach&lt;/strong&gt;: Designing for smaller screens first, then scaling up.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Mastering these made my websites look great on any device without major rework.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;CSS Can Get Messy Quickly&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I used to think CSS was simple—just write styles and everything works. But as projects grew, my stylesheets became a nightmare. Conflicting styles, specificity issues, and duplicate code made things frustrating.&lt;/p&gt;

&lt;p&gt;To avoid this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;CSS naming conventions&lt;/strong&gt; like BEM (Block-Element-Modifier) to keep things organized.&lt;/li&gt;
&lt;li&gt;Consider &lt;strong&gt;CSS-in-JS&lt;/strong&gt; if working with frameworks like React.&lt;/li&gt;
&lt;li&gt;Learn about &lt;strong&gt;Tailwind CSS or Bootstrap&lt;/strong&gt; to speed up styling while maintaining structure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Writing clean, maintainable CSS is a skill that takes time to develop, but it makes a huge difference in large projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Version Control Is a Lifesaver&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I didn’t use Git at first, and I regret it. Every time I made a change and broke something, I manually copied files to save previous versions. It was a disaster.&lt;/p&gt;

&lt;p&gt;Learning Git and GitHub early would have saved me hours of frustration. With Git, I could:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep track of every change.&lt;/li&gt;
&lt;li&gt;Revert to previous versions if I messed up.&lt;/li&gt;
&lt;li&gt;Collaborate with others without overwriting their work.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if you’re working alone, &lt;strong&gt;Git is a must-have skill&lt;/strong&gt;. The earlier you learn it, the better.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. &lt;strong&gt;Debugging Is Part of the Job&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I used to panic every time my code didn’t work. I’d delete everything and start over. Eventually, I realized that debugging is just part of being a developer.&lt;/p&gt;

&lt;p&gt;What helped me improve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Learning how to use &lt;strong&gt;Chrome DevTools&lt;/strong&gt; to inspect elements and debug JavaScript.&lt;/li&gt;
&lt;li&gt;Reading error messages carefully instead of ignoring them.&lt;/li&gt;
&lt;li&gt;Using &lt;strong&gt;console.log()&lt;/strong&gt; strategically to understand what’s happening in my code.&lt;/li&gt;
&lt;li&gt;Writing small, testable pieces of code instead of huge, unmanageable functions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Debugging is a skill, and the more you do it, the easier it gets.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. &lt;strong&gt;Not Every Tool or Framework Is Necessary&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;It’s easy to get overwhelmed by the number of tools available. Every day, there’s a new library or framework trending on Twitter. I used to jump from one tool to another without truly mastering anything.&lt;/p&gt;

&lt;p&gt;Now, I follow this rule:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Learn the &lt;strong&gt;fundamentals first&lt;/strong&gt; (HTML, CSS, JavaScript).&lt;/li&gt;
&lt;li&gt;Pick &lt;strong&gt;one&lt;/strong&gt; JavaScript framework (React, Vue, or Angular) and stick with it.&lt;/li&gt;
&lt;li&gt;Use tools only when they &lt;strong&gt;solve a real problem&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don’t fall into the trap of constantly switching tools just because they’re popular. &lt;strong&gt;Focus on depth over breadth.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  8. &lt;strong&gt;Soft Skills Matter Too&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I thought being a frontend developer meant just writing code. But working in tech involves more than that. Communication, problem-solving, and teamwork are just as important.&lt;/p&gt;

&lt;p&gt;Some key soft skills that made a difference for me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Writing clear documentation&lt;/strong&gt; so others (and future me) can understand my code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asking good questions&lt;/strong&gt; instead of struggling alone for hours.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Learning to take feedback&lt;/strong&gt; without feeling defensive.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Great developers are not just good at coding—they are good at working with others too.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. &lt;strong&gt;Projects Teach More Than Tutorials&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I spent months watching tutorials, thinking I was learning. But when I tried to build something on my own, I was stuck.&lt;/p&gt;

&lt;p&gt;The truth is: &lt;strong&gt;You don’t learn until you build.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some of the best ways to improve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Recreate websites you admire&lt;/strong&gt; to understand how they are built.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contribute to open-source projects&lt;/strong&gt; to gain real-world experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Start a side project&lt;/strong&gt; that solves a real problem, even if it’s small.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tutorials are helpful, but &lt;strong&gt;applying what you learn is what truly makes you a developer.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" alt="Image description" width="800" height="464"&gt;&lt;/a&gt;&lt;br&gt;
If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;Frontend development is exciting, but it comes with challenges. Looking back, I wish I had focused on JavaScript earlier, embraced debugging, and worked on real projects instead of just watching tutorials.&lt;/p&gt;

&lt;p&gt;If you’re starting now, don’t rush. Learn step by step, build real projects, and don’t get distracted by every new trend. The more you practice, the better you’ll get.&lt;/p&gt;

&lt;p&gt;Frontend development isn’t just about coding—it’s about solving problems, improving experiences, and continuously learning. Enjoy the journey!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>7 JavaScript Features Every Frontend Developer Should Know</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Wed, 05 Mar 2025 16:19:21 +0000</pubDate>
      <link>https://dev.to/rowsanali/7-javascript-features-every-frontend-developer-should-know-1po4</link>
      <guid>https://dev.to/rowsanali/7-javascript-features-every-frontend-developer-should-know-1po4</guid>
      <description>&lt;p&gt;JavaScript is constantly evolving, introducing new features that make coding more efficient, readable, and maintainable. If you're a frontend developer, understanding these features can significantly improve your workflow.&lt;/p&gt;

&lt;p&gt;Here are 7 essential JavaScript features you should know:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" alt="Image description" width="800" height="464"&gt;&lt;/a&gt;&lt;br&gt;
If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;1. Optional Chaining (&lt;code&gt;?.&lt;/code&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before optional chaining, checking for deeply nested properties required long chains of conditionals. Now, JavaScript makes it easy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// John&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// undefined (no error)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If any property in the chain is &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;, JavaScript returns &lt;code&gt;undefined&lt;/code&gt; instead of throwing an error.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;2. Nullish Coalescing (&lt;code&gt;??&lt;/code&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;??&lt;/code&gt; operator helps when you need to provide a default value but want to distinguish between &lt;code&gt;null&lt;/code&gt;/&lt;code&gt;undefined&lt;/code&gt; and falsy values like &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;""&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Default Value&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "Default Value"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s a cleaner alternative to using &lt;code&gt;||&lt;/code&gt;, which would treat &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;""&lt;/code&gt; as falsy values.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;3. Destructuring Assignment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Destructuring allows you to extract values from objects or arrays in a cleaner way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Alice&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 25&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This reduces redundant code when accessing object properties.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;4. Template Literals&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of messy string concatenation, template literals allow cleaner string formatting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Tom&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Hello, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;!`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "Hello, Tom!"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They also support multi-line strings without needing &lt;code&gt;\n&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;multiLine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`This is line 1
This is line 2`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;multiLine&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;5. Arrow Functions (&lt;code&gt;=&amp;gt;&lt;/code&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Arrow functions provide a shorter syntax and automatically bind &lt;code&gt;this&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// 5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For single-expression functions, you can omit curly braces and the &lt;code&gt;return&lt;/code&gt; keyword.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;6. Spread and Rest Operators (&lt;code&gt;...&lt;/code&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The spread operator (&lt;code&gt;...&lt;/code&gt;) expands elements, while the rest operator collects arguments into an array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spread Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newNumbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;newNumbers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// [1, 2, 3, 4, 5]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Rest Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;total&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// 6&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;7. Promises and Async/Await&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Handling asynchronous operations is easier with Promises and &lt;code&gt;async/await&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using Promises:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.example.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using Async/Await:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchData&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.example.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;fetchData&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Async/await makes asynchronous code more readable and easier to debug.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feevl70bcnohe24aw9rf3.png" alt="Image description" width="800" height="464"&gt;&lt;/a&gt;&lt;br&gt;
If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mastering these JavaScript features will make your code cleaner, more efficient, and easier to maintain. As JavaScript evolves, staying up to date with new features will help you write modern and scalable applications.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>10 VS Code Extensions That Will Instantly Boost Productivity</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Tue, 04 Mar 2025 07:54:36 +0000</pubDate>
      <link>https://dev.to/rowsanali/10-vs-code-extensions-that-will-instantly-boost-productivity-1ehm</link>
      <guid>https://dev.to/rowsanali/10-vs-code-extensions-that-will-instantly-boost-productivity-1ehm</guid>
      <description>&lt;p&gt;Visual Studio Code (VS Code) has become one of the most popular code editors among developers, and for good reason. It’s lightweight, highly customizable, and packed with features that make coding more efficient. One of the key reasons for its popularity is its extensive library of extensions. These extensions can supercharge your workflow, automate repetitive tasks, and help you write better code faster.&lt;/p&gt;

&lt;p&gt;In this blog post, we’ll explore &lt;strong&gt;10 VS Code extensions&lt;/strong&gt; that will instantly boost your productivity. Whether you’re a front-end developer, back-end engineer, or full-stack wizard, these tools will help you save time and focus on what really matters: writing great code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvq2c2hdk7gngbsxazvk2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvq2c2hdk7gngbsxazvk2.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nas.io/ace-hensly/products/gaee" rel="noopener noreferrer"&gt;Download Now&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;strong&gt;Prettier – Code Formatter&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Prettier is a must-have extension for any developer who values clean, consistent code. It automatically formats your code to adhere to a consistent style, saving you the hassle of manually adjusting indentation, spacing, and line breaks. Prettier supports a wide range of languages, including JavaScript, TypeScript, CSS, HTML, and JSON.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it boosts productivity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Eliminates debates over code style in team projects.&lt;/li&gt;
&lt;li&gt;Automatically formats code on save, so you don’t have to think about it.&lt;/li&gt;
&lt;li&gt;Ensures consistency across your codebase.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. &lt;strong&gt;ESLint&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;ESLint is a powerful linting tool that helps you catch errors and enforce coding standards in JavaScript and TypeScript. It integrates seamlessly with VS Code, providing real-time feedback on potential issues in your code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it boosts productivity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Catches syntax errors and bugs before they make it to production.&lt;/li&gt;
&lt;li&gt;Enforces coding standards and best practices.&lt;/li&gt;
&lt;li&gt;Customizable rules to fit your team’s needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. &lt;strong&gt;GitLens – Git Supercharged&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;GitLens supercharges the Git capabilities built into VS Code. It provides detailed insights into your codebase, such as who last modified a line of code, why it was changed, and when. It also makes it easier to navigate through branches, commits, and repositories.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it boosts productivity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Streamlines Git workflows with inline blame annotations and commit history.&lt;/li&gt;
&lt;li&gt;Simplifies code reviews by providing context for changes.&lt;/li&gt;
&lt;li&gt;Enhances collaboration by making it easier to understand code changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. &lt;strong&gt;Live Server&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Live Server is a lifesaver for front-end developers. It launches a local development server with live reloading, so you can see changes to your HTML, CSS, and JavaScript files in real-time as you code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it boosts productivity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Saves time by automatically refreshing the browser when you make changes.&lt;/li&gt;
&lt;li&gt;Perfect for testing responsive designs and debugging.&lt;/li&gt;
&lt;li&gt;Lightweight and easy to set up.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. &lt;strong&gt;Bracket Pair Colorizer&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Bracket Pair Colorizer is a simple yet incredibly useful extension that colorizes matching brackets in your code. This makes it much easier to navigate complex nested structures, especially in languages like JavaScript, Python, or C++.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it boosts productivity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduces time spent searching for matching brackets.&lt;/li&gt;
&lt;li&gt;Improves code readability, especially in deeply nested code.&lt;/li&gt;
&lt;li&gt;Customizable colors to suit your preferences.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. &lt;strong&gt;Auto Rename Tag&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you work with HTML or XML, Auto Rename Tag is a game-changer. When you rename an opening tag, it automatically renames the corresponding closing tag, and vice versa.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it boosts productivity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Eliminates the need to manually update closing tags.&lt;/li&gt;
&lt;li&gt;Reduces errors caused by mismatched tags.&lt;/li&gt;
&lt;li&gt;Works seamlessly with JSX and Vue templates.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  7. &lt;strong&gt;Path Intellisense&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Path Intellisense is a handy extension that autocompletes file paths as you type. Whether you’re importing a module in JavaScript or linking to a stylesheet in HTML, this extension saves you from manually typing out long file paths.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it boosts productivity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Speeds up file navigation and imports.&lt;/li&gt;
&lt;li&gt;Reduces errors caused by typos in file paths.&lt;/li&gt;
&lt;li&gt;Works with a wide range of file types.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  8. &lt;strong&gt;Code Runner&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Code Runner allows you to quickly run code snippets or files in multiple languages, including Python, Java, C++, and more. It’s perfect for testing small pieces of code without leaving VS Code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it boosts productivity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Saves time by running code directly in the editor.&lt;/li&gt;
&lt;li&gt;Supports a wide range of programming languages.&lt;/li&gt;
&lt;li&gt;Great for quick prototyping and debugging.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  9. &lt;strong&gt;Todo Tree&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Todo Tree helps you keep track of all the &lt;code&gt;TODO&lt;/code&gt;, &lt;code&gt;FIXME&lt;/code&gt;, and &lt;code&gt;NOTE&lt;/code&gt; comments in your codebase. It scans your files and organizes these comments into a tree view, making it easy to jump to specific tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it boosts productivity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keeps track of pending tasks and improvements.&lt;/li&gt;
&lt;li&gt;Helps you stay organized and focused.&lt;/li&gt;
&lt;li&gt;Customizable tags and filters.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  10. &lt;strong&gt;Remote – SSH&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The Remote – SSH extension allows you to work on remote servers directly from VS Code. It’s perfect for developers who need to edit files or debug code on a remote machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it boosts productivity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Eliminates the need to switch between local and remote environments.&lt;/li&gt;
&lt;li&gt;Provides a seamless development experience on remote servers.&lt;/li&gt;
&lt;li&gt;Great for working with cloud-based development environments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bonus Tip: Syncing Your Extensions
&lt;/h2&gt;

&lt;p&gt;If you use VS Code across multiple machines, consider using the &lt;strong&gt;Settings Sync&lt;/strong&gt; extension. It syncs your extensions, settings, and keybindings across devices, so you can pick up right where you left off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;VS Code’s extensibility is one of its greatest strengths, and these 10 extensions are just the tip of the iceberg. By incorporating these tools into your workflow, you can save time, reduce errors, and focus on what you do best: writing great code.&lt;/p&gt;

&lt;p&gt;What are your favorite VS Code extensions? Let us know in the comments below! And if you found this post helpful, don’t forget to share it with your fellow developers. Happy coding! 🚀&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvq2c2hdk7gngbsxazvk2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvq2c2hdk7gngbsxazvk2.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nas.io/ace-hensly/products/gaee" rel="noopener noreferrer"&gt;Download Now&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; To install any of these extensions, simply open the Extensions view in VS Code (&lt;code&gt;Ctrl+Shift+X&lt;/code&gt; or &lt;code&gt;Cmd+Shift+X&lt;/code&gt; on macOS), search for the extension by name, and click Install.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>5 Common Mistakes Frontend Developers Make (And How to Fix Them)</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Sun, 02 Mar 2025 12:01:53 +0000</pubDate>
      <link>https://dev.to/rowsanali/5-common-mistakes-frontend-developers-make-and-how-to-fix-them-2chb</link>
      <guid>https://dev.to/rowsanali/5-common-mistakes-frontend-developers-make-and-how-to-fix-them-2chb</guid>
      <description>&lt;p&gt;Frontend development is a dynamic and ever-evolving field. With the constant introduction of new frameworks, libraries, and tools, it's easy to make mistakes, especially when you're under pressure to deliver a project quickly. In this blog post, we'll explore five common mistakes that frontend developers often make and provide practical solutions to fix them. We'll also include code examples to help you understand how to implement these fixes in your own projects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvq2c2hdk7gngbsxazvk2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvq2c2hdk7gngbsxazvk2.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nas.io/734ray/products/ddnm" rel="noopener noreferrer"&gt;Download Now&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;strong&gt;Not Using Semantic HTML&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Mistake:
&lt;/h3&gt;

&lt;p&gt;One of the most common mistakes frontend developers make is not using semantic HTML. Instead of using appropriate HTML elements like &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt;, and &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt;, developers often rely heavily on &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; tags. This can lead to poorly structured and inaccessible web pages.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fix:
&lt;/h3&gt;

&lt;p&gt;Semantic HTML not only improves the readability of your code but also enhances accessibility and SEO. Use semantic elements to describe the structure of your content.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Bad Practice --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"header"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav-item"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav-item"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;About&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Good Practice --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;nav&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/about"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;About&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the good practice example, we use &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;, and &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; elements to create a more meaningful and accessible structure.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. &lt;strong&gt;Ignoring Responsive Design&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Mistake:
&lt;/h3&gt;

&lt;p&gt;Another common mistake is not implementing responsive design. With the variety of devices and screen sizes available today, it's crucial to ensure that your website looks good and functions well on all devices. Ignoring responsive design can lead to a poor user experience.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fix:
&lt;/h3&gt;

&lt;p&gt;Use CSS media queries to create a responsive layout. Additionally, consider using a mobile-first approach, where you design for smaller screens first and then add styles for larger screens.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Bad Practice */&lt;/span&gt;
&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1200px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Good Practice */&lt;/span&gt;
&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1200px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;768px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the good practice example, we use &lt;code&gt;max-width&lt;/code&gt; instead of a fixed width and add padding to ensure the container adjusts to different screen sizes.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;strong&gt;Overloading JavaScript&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Mistake:
&lt;/h3&gt;

&lt;p&gt;Frontend developers often rely too heavily on JavaScript for tasks that can be accomplished with HTML and CSS. Overloading JavaScript can lead to performance issues, especially on low-powered devices.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fix:
&lt;/h3&gt;

&lt;p&gt;Use JavaScript only when necessary. Many interactive features, such as dropdown menus, modals, and animations, can be implemented using HTML and CSS alone.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Bad Practice --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"toggleDropdown()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Menu&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"dropdown"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"display: none;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;Item 1&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;Item 2&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;toggleDropdown&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dropdown&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dropdown&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;dropdown&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;display&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;dropdown&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;display&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;block&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Good Practice --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;details&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;Menu&lt;span class="nt"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;Item 1&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;Item 2&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/details&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the good practice example, we use the &lt;code&gt;&amp;lt;details&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;summary&amp;gt;&lt;/code&gt; elements to create a dropdown menu without any JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. &lt;strong&gt;Not Optimizing Images&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Mistake:
&lt;/h3&gt;

&lt;p&gt;Images are often the largest assets on a webpage, and not optimizing them can lead to slow load times and a poor user experience. Frontend developers sometimes forget to compress images or use appropriate formats.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fix:
&lt;/h3&gt;

&lt;p&gt;Optimize images by compressing them and using modern formats like WebP. Additionally, use responsive images with the &lt;code&gt;srcset&lt;/code&gt; attribute to serve different sizes based on the user's device.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Bad Practice --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"large-image.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"A large image"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Good Practice --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; 
  &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"image-320w.webp"&lt;/span&gt; 
  &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;"image-320w.webp 320w, image-480w.webp 480w, image-800w.webp 800w"&lt;/span&gt;
  &lt;span class="na"&gt;sizes=&lt;/span&gt;&lt;span class="s"&gt;"(max-width: 320px) 280px, (max-width: 480px) 440px, 800px"&lt;/span&gt;
  &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"An optimized image"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the good practice example, we use the &lt;code&gt;srcset&lt;/code&gt; attribute to serve different image sizes based on the viewport width, ensuring faster load times.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. &lt;strong&gt;Not Testing Across Browsers&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Mistake:
&lt;/h3&gt;

&lt;p&gt;Frontend developers often test their websites only on one or two browsers, usually Chrome and Firefox. This can lead to inconsistencies and bugs in other browsers like Safari, Edge, or even older versions of popular browsers.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fix:
&lt;/h3&gt;

&lt;p&gt;Always test your website across multiple browsers and devices. Use tools like BrowserStack or CrossBrowserTesting to ensure compatibility. Additionally, consider using CSS prefixes and polyfills for older browsers.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Bad Practice */&lt;/span&gt;
&lt;span class="nc"&gt;.box&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Good Practice */&lt;/span&gt;
&lt;span class="nc"&gt;.box&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;-webkit-box&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Safari */&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;-ms-flexbox&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* IE 10 */&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;-webkit-box-pack&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Safari */&lt;/span&gt;
  &lt;span class="nl"&gt;-ms-flex-pack&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* IE 10 */&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;-webkit-box-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Safari */&lt;/span&gt;
  &lt;span class="nl"&gt;-ms-flex-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* IE 10 */&lt;/span&gt;
  &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the good practice example, we use CSS prefixes to ensure that the flexbox layout works correctly in older browsers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvq2c2hdk7gngbsxazvk2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvq2c2hdk7gngbsxazvk2.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nas.io/734ray/products/ddnm" rel="noopener noreferrer"&gt;Download Now&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Frontend development is a challenging but rewarding field. By avoiding these common mistakes and implementing the fixes we've discussed, you can create more efficient, accessible, and user-friendly websites. Remember to always use semantic HTML, prioritize responsive design, minimize JavaScript usage, optimize images, and test across browsers. Happy coding!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>10 CSS Tricks Every Frontend Developer Should Know</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Sat, 01 Mar 2025 12:52:50 +0000</pubDate>
      <link>https://dev.to/rowsanali/10-css-tricks-every-frontend-developer-should-know-4cj4</link>
      <guid>https://dev.to/rowsanali/10-css-tricks-every-frontend-developer-should-know-4cj4</guid>
      <description>&lt;p&gt;CSS (Cascading Style Sheets) is the backbone of web design, allowing developers to create visually stunning and responsive websites. While CSS is relatively easy to learn, mastering it requires a deep understanding of its nuances and advanced techniques. In this blog post, we’ll explore &lt;strong&gt;10 CSS tricks&lt;/strong&gt; that every frontend developer should know to level up their skills and create more efficient, maintainable, and visually appealing websites.&lt;/p&gt;

&lt;p&gt;If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  1. &lt;strong&gt;CSS Variables for Consistent Styling&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;CSS variables (also known as custom properties) allow you to store reusable values, such as colors, fonts, and spacing, in one place. This makes it easier to maintain consistency across your stylesheet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;--primary-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#3498db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;16px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--primary-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--font-size&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--primary-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt; If you need to change the primary color, you only need to update it in one place (&lt;code&gt;:root&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  2. &lt;strong&gt;Flexbox for Layouts&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Flexbox is a powerful layout module that simplifies the process of creating responsive and flexible layouts. It’s perfect for aligning items horizontally or vertically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;space-between&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.item&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt; Flexbox eliminates the need for floats and hacks to create complex layouts.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;strong&gt;Grid for Advanced Layouts&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;CSS Grid is another layout system that allows you to create two-dimensional layouts with rows and columns. It’s ideal for building grid-based designs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;grid-template-columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;repeat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="n"&gt;fr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="py"&gt;gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.item&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;grid-column&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt; Grid provides precise control over the placement and sizing of elements.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. &lt;strong&gt;Responsive Design with Media Queries&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Media queries enable you to apply styles based on the device’s screen size, making your website responsive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;768px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt; Ensures your website looks great on all devices, from mobile to desktop.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. &lt;strong&gt;Transitions and Animations&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;CSS transitions and animations add interactivity and polish to your website. Use them to create smooth hover effects or animated elements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#3498db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.button&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#2980b9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;slide&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;from&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-100%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;to&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.slide-in&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;slide&lt;/span&gt; &lt;span class="m"&gt;0.5s&lt;/span&gt; &lt;span class="n"&gt;ease-out&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt; Enhances user experience with subtle animations.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. &lt;strong&gt;Pseudo-elements for Extra Content&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Pseudo-elements (&lt;code&gt;::before&lt;/code&gt; and &lt;code&gt;::after&lt;/code&gt;) allow you to insert content without modifying your HTML.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.tooltip&lt;/span&gt;&lt;span class="nd"&gt;::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Tooltip text"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#333&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.tooltip&lt;/span&gt;&lt;span class="nd"&gt;:hover::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt; Adds decorative or functional elements without cluttering your HTML.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. &lt;strong&gt;Custom Cursors&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You can change the default cursor to a custom one using the &lt;code&gt;cursor&lt;/code&gt; property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.custom-cursor&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url('custom-cursor.png')&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt; Improves user interaction and adds a unique touch to your design.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. &lt;strong&gt;Clip-path for Creative Shapes&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;clip-path&lt;/code&gt; property allows you to create complex shapes by clipping an element.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.shape&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;200px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;200px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#3498db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;clip-path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;polygon&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;50%&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt; Enables you to create visually interesting designs without images.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. &lt;strong&gt;Sticky Positioning&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;position: sticky&lt;/code&gt; property makes an element stick to the top of the viewport when scrolling.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sticky&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt; Perfect for creating sticky headers or navigation bars.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. &lt;strong&gt;Dark Mode with CSS&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You can easily implement dark mode using the &lt;code&gt;prefers-color-scheme&lt;/code&gt; media query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prefers-color-scheme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;dark&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#333&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt; Improves accessibility and user experience by adapting to user preferences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus Tip: &lt;strong&gt;CSS Reset for Consistent Styling&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Different browsers have default styles that can cause inconsistencies. A CSS reset ensures a clean slate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;box-sizing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;border-box&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt; Eliminates browser inconsistencies and provides a uniform starting point.&lt;/p&gt;

&lt;p&gt;If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Mastering these CSS tricks will not only make you a more efficient frontend developer but also enable you to create more dynamic and visually appealing websites. Whether you’re working on a small project or a large-scale application, these techniques will help you write cleaner, more maintainable code.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>30 Best Free Tools for Frontend Developers in 2025</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Sat, 01 Mar 2025 08:49:25 +0000</pubDate>
      <link>https://dev.to/rowsanali/30-best-free-tools-for-frontend-developers-in-2025-1gdm</link>
      <guid>https://dev.to/rowsanali/30-best-free-tools-for-frontend-developers-in-2025-1gdm</guid>
      <description>&lt;p&gt;Frontend development is an ever-evolving field, with new tools and technologies emerging regularly. Whether you're a seasoned developer or just starting out, having the right tools can significantly boost your productivity, streamline your workflow, and help you create stunning, responsive, and user-friendly websites. The best part? Many of these tools are completely free!&lt;/p&gt;

&lt;p&gt;In this blog post, we’ll explore &lt;strong&gt;30 of the best free tools for frontend developers&lt;/strong&gt; in 2025. From code editors to design resources, debugging tools, and performance optimizers, this list has something for everyone. Let’s dive in!&lt;/p&gt;

&lt;p&gt;If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Visual Studio Code (VS Code)&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A lightweight, open-source code editor by Microsoft.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: VS Code is packed with features like IntelliSense (smart code completion), debugging, Git integration, and a vast library of extensions. It’s highly customizable and supports almost every programming language.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;code.visualstudio.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2. GitHub&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A platform for version control and collaboration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: GitHub allows you to host and review code, manage projects, and collaborate with other developers. It’s essential for open-source projects and team workflows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;github.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Figma&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A cloud-based design and prototyping tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Figma is perfect for designing user interfaces, creating prototypes, and collaborating with designers and developers in real time. Its free plan is robust enough for most projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://www.figma.com/" rel="noopener noreferrer"&gt;figma.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;4. Chrome DevTools&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A set of web developer tools built directly into the Google Chrome browser.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: DevTools allows you to inspect and debug HTML, CSS, and JavaScript, analyze performance, and test responsive designs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How to access&lt;/strong&gt;: Right-click on any webpage and select "Inspect" or press &lt;code&gt;Ctrl+Shift+I&lt;/code&gt; (Windows) or &lt;code&gt;Cmd+Option+I&lt;/code&gt; (Mac).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;5. CodePen&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: An online code editor and community for frontend developers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: CodePen is perfect for testing code snippets, experimenting with new ideas, and sharing your work with others. It supports HTML, CSS, and JavaScript.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://codepen.io/" rel="noopener noreferrer"&gt;codepen.io&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;6. Bootstrap&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A popular CSS framework for building responsive, mobile-first websites.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Bootstrap provides pre-designed components like buttons, navbars, and grids, making it easier to create consistent and professional designs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://getbootstrap.com/" rel="noopener noreferrer"&gt;getbootstrap.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;7. Tailwind CSS&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A utility-first CSS framework.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Tailwind allows you to build custom designs directly in your HTML without writing custom CSS. It’s highly flexible and perfect for rapid prototyping.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://tailwindcss.com/" rel="noopener noreferrer"&gt;tailwindcss.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;8. Font Awesome&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A library of free icons and social logos.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Font Awesome provides scalable vector icons that can be customized with CSS. It’s a must-have for adding visual elements to your projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://fontawesome.com/" rel="noopener noreferrer"&gt;fontawesome.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;9. Google Fonts&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A library of free, open-source fonts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Google Fonts offers hundreds of high-quality fonts that can be easily integrated into your projects via a simple link.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://fonts.google.com/" rel="noopener noreferrer"&gt;fonts.google.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;10. Canva&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A graphic design tool for creating visuals.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Canva is perfect for creating banners, logos, and other design assets without needing advanced design skills. Its free plan is incredibly versatile.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://www.canva.com/" rel="noopener noreferrer"&gt;canva.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;11. ESLint&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A static code analysis tool for JavaScript.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: ESLint helps you find and fix problems in your JavaScript code, ensuring consistency and best practices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://eslint.org/" rel="noopener noreferrer"&gt;eslint.org&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;12. Prettier&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A code formatter for JavaScript, CSS, and HTML.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Prettier automatically formats your code, making it cleaner and more readable. It integrates seamlessly with most code editors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://prettier.io/" rel="noopener noreferrer"&gt;prettier.io&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;13. Webpack&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A module bundler for JavaScript applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Webpack bundles your JavaScript, CSS, and other assets into a single file, optimizing performance and simplifying deployment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://webpack.js.org/" rel="noopener noreferrer"&gt;webpack.js.org&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;14. Babel&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A JavaScript compiler.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Babel allows you to use the latest JavaScript features by converting modern code into a version compatible with older browsers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://babeljs.io/" rel="noopener noreferrer"&gt;babeljs.io&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;15. Sass&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A CSS preprocessor.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Sass adds features like variables, nesting, and mixins to CSS, making it more powerful and maintainable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://sass-lang.com/" rel="noopener noreferrer"&gt;sass-lang.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;16. PostCSS&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A tool for transforming CSS with JavaScript plugins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: PostCSS allows you to automate tasks like autoprefixing, minification, and linting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://postcss.org/" rel="noopener noreferrer"&gt;postcss.org&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;17. Lighthouse&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: An open-source tool for auditing web page performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Lighthouse provides insights into performance, accessibility, SEO, and more. It’s built into Chrome DevTools.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How to access&lt;/strong&gt;: Open Chrome DevTools and navigate to the "Lighthouse" tab.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;18. Netlify&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A platform for deploying and hosting static websites.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Netlify offers continuous deployment, serverless functions, and a free tier for hosting personal projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;netlify.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;19. Vercel&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A platform for deploying frontend applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Vercel is optimized for Next.js and provides fast deployments, serverless functions, and a free tier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://vercel.com/" rel="noopener noreferrer"&gt;vercel.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;20. Responsively&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A tool for testing responsive designs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Responsively allows you to preview your website on multiple screen sizes simultaneously, making it easier to ensure a consistent experience across devices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://responsively.app/" rel="noopener noreferrer"&gt;responsively.app&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;21. Unsplash&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A library of free, high-resolution images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Unsplash provides stunning visuals that you can use in your projects without worrying about licensing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://unsplash.com/" rel="noopener noreferrer"&gt;unsplash.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;22. Pexels&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: Another source of free stock photos and videos.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Pexels offers a wide variety of high-quality media that’s free for personal and commercial use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://www.pexels.com/" rel="noopener noreferrer"&gt;pexels.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;23. Animista&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A CSS animation library.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Animista provides ready-to-use CSS animations that you can customize and integrate into your projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://animista.net/" rel="noopener noreferrer"&gt;animista.net&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;24. CSS Grid Generator&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A tool for generating CSS grid layouts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: This tool simplifies the process of creating complex grid layouts with an intuitive interface.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://cssgrid-generator.netlify.app/" rel="noopener noreferrer"&gt;cssgrid-generator.netlify.app&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;25. Flexbox Froggy&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A game for learning CSS Flexbox.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Flexbox Froggy makes learning Flexbox fun and interactive, perfect for beginners.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://flexboxfroggy.com/" rel="noopener noreferrer"&gt;flexboxfroggy.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;26. SVGOMG&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A tool for optimizing SVG files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: SVGOMG reduces the file size of SVGs without compromising quality, improving website performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://jakearchibald.github.io/svgomg/" rel="noopener noreferrer"&gt;jakearchibald.github.io/svgomg/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;27. Color Hunt&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A collection of color palettes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Color Hunt helps you find beautiful and trendy color combinations for your designs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://colorhunt.co/" rel="noopener noreferrer"&gt;colorhunt.co&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;28. Coolors&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A color scheme generator.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: Coolors allows you to create and customize color palettes quickly and easily.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://coolors.co/" rel="noopener noreferrer"&gt;coolors.co&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;29. TinyPNG&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A tool for compressing images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: TinyPNG reduces the file size of PNG and JPEG images, improving website load times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://tinypng.com/" rel="noopener noreferrer"&gt;tinypng.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;30. The A11Y Project&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is&lt;/strong&gt;: A resource for learning about web accessibility.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it’s great&lt;/strong&gt;: The A11Y Project provides guidelines, tools, and tips for making your websites more accessible to all users.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://www.a11yproject.com/" rel="noopener noreferrer"&gt;a11yproject.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Frontend development is a dynamic and creative field, and having the right tools can make all the difference. The 30 tools listed above are completely free and cater to various aspects of frontend development, from coding and design to debugging and optimization. Whether you’re building a personal project or working on a large-scale application, these tools will help you work smarter, faster, and more efficiently.&lt;/p&gt;

&lt;p&gt;Happy coding! 🚀&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to Work with the DOM: Event Listeners and Manipulation</title>
      <dc:creator>Rowsan Ali</dc:creator>
      <pubDate>Fri, 28 Feb 2025 17:57:02 +0000</pubDate>
      <link>https://dev.to/rowsanali/how-to-work-with-the-dom-event-listeners-and-manipulation-59pf</link>
      <guid>https://dev.to/rowsanali/how-to-work-with-the-dom-event-listeners-and-manipulation-59pf</guid>
      <description>&lt;p&gt;The Document Object Model (DOM) is a programming interface for web documents. It represents the structure of a document as a tree of objects, where each object corresponds to a part of the document, such as elements, attributes, and text. JavaScript can interact with the DOM to dynamically change the content, structure, and style of a web page.&lt;/p&gt;

&lt;p&gt;If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this blog post, we'll explore two fundamental aspects of working with the DOM: &lt;strong&gt;event listeners&lt;/strong&gt; and &lt;strong&gt;DOM manipulation&lt;/strong&gt;. We'll cover how to attach event listeners to DOM elements to respond to user interactions and how to manipulate the DOM to dynamically update the content and appearance of a web page.&lt;/p&gt;
&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;What is the DOM?&lt;/li&gt;
&lt;li&gt;Selecting DOM Elements&lt;/li&gt;
&lt;li&gt;
Event Listeners

&lt;ul&gt;
&lt;li&gt;Adding Event Listeners&lt;/li&gt;
&lt;li&gt;Common Event Types&lt;/li&gt;
&lt;li&gt;Removing Event Listeners&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
DOM Manipulation

&lt;ul&gt;
&lt;li&gt;Changing Element Content&lt;/li&gt;
&lt;li&gt;Modifying Element Attributes&lt;/li&gt;
&lt;li&gt;Adding and Removing Elements&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  1. What is the DOM?
&lt;/h2&gt;

&lt;p&gt;The DOM is a tree-like representation of the HTML document. Each node in the tree represents an element, attribute, or piece of text. JavaScript can interact with the DOM to dynamically change the content, structure, and style of a web page.&lt;/p&gt;

&lt;p&gt;For example, consider the following HTML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;DOM Example&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"title"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Hello, World!&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"changeText"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Change Text&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the DOM tree would have a root node (&lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt;), with child nodes for &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;. The &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; element contains an &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; element and a &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; element.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Selecting DOM Elements
&lt;/h2&gt;

&lt;p&gt;Before you can manipulate the DOM or attach event listeners, you need to select the DOM elements you want to work with. JavaScript provides several methods for selecting elements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;document.getElementById(id)&lt;/code&gt;: Selects an element by its &lt;code&gt;id&lt;/code&gt; attribute.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;document.querySelector(selector)&lt;/code&gt;: Selects the first element that matches a CSS selector.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;document.querySelectorAll(selector)&lt;/code&gt;: Selects all elements that match a CSS selector.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, to select the &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; element with the &lt;code&gt;id&lt;/code&gt; of &lt;code&gt;title&lt;/code&gt;, you can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;titleElement&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;title&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or, using &lt;code&gt;querySelector&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;titleElement&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#title&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Event Listeners
&lt;/h2&gt;

&lt;p&gt;Event listeners are functions that wait for a specific event to occur on a DOM element, such as a click, mouseover, or keypress. When the event occurs, the event listener executes a callback function.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding Event Listeners
&lt;/h3&gt;

&lt;p&gt;To add an event listener to an element, you can use the &lt;code&gt;addEventListener&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;eventType&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callbackFunction&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, let's add an event listener to the button in our HTML that changes the text of the &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; element when clicked:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;changeTextButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;changeText&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;titleElement&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;title&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;changeTextButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;titleElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Text Changed!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, when the button is clicked, the text content of the &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; element is changed to "Text Changed!".&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Event Types
&lt;/h3&gt;

&lt;p&gt;Here are some common event types you might use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;click&lt;/code&gt;: Occurs when an element is clicked.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mouseover&lt;/code&gt;: Occurs when the mouse pointer is moved over an element.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mouseout&lt;/code&gt;: Occurs when the mouse pointer is moved out of an element.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;keydown&lt;/code&gt;: Occurs when a key is pressed down.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;keyup&lt;/code&gt;: Occurs when a key is released.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;submit&lt;/code&gt;: Occurs when a form is submitted.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Removing Event Listeners
&lt;/h3&gt;

&lt;p&gt;You can also remove an event listener using the &lt;code&gt;removeEventListener&lt;/code&gt; method. To do this, you need to pass the same event type and callback function that was used when adding the event listener.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;eventType&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callbackFunction&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, let's remove the event listener we added earlier:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;changeText&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;titleElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Text Changed!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;changeTextButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;changeText&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Later, to remove the event listener&lt;/span&gt;
&lt;span class="nx"&gt;changeTextButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;changeText&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. DOM Manipulation
&lt;/h2&gt;

&lt;p&gt;DOM manipulation involves changing the content, structure, or style of a web page dynamically using JavaScript. Let's explore some common DOM manipulation techniques.&lt;/p&gt;

&lt;h3&gt;
  
  
  Changing Element Content
&lt;/h3&gt;

&lt;p&gt;You can change the content of an element using properties like &lt;code&gt;textContent&lt;/code&gt; and &lt;code&gt;innerHTML&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;textContent&lt;/code&gt;: Sets or returns the text content of an element.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;innerHTML&lt;/code&gt;: Sets or returns the HTML content of an element.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, to change the text content of the &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; element:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;titleElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;New Title&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or, to change the HTML content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;titleElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;em&amp;gt;New Title&amp;lt;/em&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Modifying Element Attributes
&lt;/h3&gt;

&lt;p&gt;You can modify element attributes using methods like &lt;code&gt;setAttribute&lt;/code&gt; and &lt;code&gt;getAttribute&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;setAttribute(name, value)&lt;/code&gt;: Sets the value of an attribute.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;getAttribute(name)&lt;/code&gt;: Returns the value of an attribute.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, to change the &lt;code&gt;src&lt;/code&gt; attribute of an image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;imageElement&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;img&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;imageElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;src&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;new-image.jpg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Adding and Removing Elements
&lt;/h3&gt;

&lt;p&gt;You can add new elements to the DOM or remove existing ones using methods like &lt;code&gt;createElement&lt;/code&gt;, &lt;code&gt;appendChild&lt;/code&gt;, and &lt;code&gt;removeChild&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;createElement(tagName)&lt;/code&gt;: Creates a new element.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;appendChild(child)&lt;/code&gt;: Adds a new child element to a parent element.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;removeChild(child)&lt;/code&gt;: Removes a child element from a parent element.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, let's add a new paragraph to the body:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newParagraph&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;p&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;newParagraph&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;This is a new paragraph.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;newParagraph&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To remove the paragraph:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;newParagraph&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Conclusion
&lt;/h2&gt;

&lt;p&gt;Working with the DOM is a fundamental skill for web developers. By understanding how to select elements, attach event listeners, and manipulate the DOM, you can create dynamic and interactive web pages.&lt;/p&gt;

&lt;p&gt;In this blog post, we covered the basics of selecting DOM elements, adding and removing event listeners, and performing common DOM manipulation tasks. With these skills, you can start building more interactive and responsive web applications.&lt;/p&gt;

&lt;p&gt;Remember, the DOM is a powerful tool, but it's important to use it efficiently to avoid performance issues. Always consider the impact of your DOM manipulations on the overall performance of your web page.&lt;/p&gt;

&lt;p&gt;If you're a developer or just starting out.&lt;br&gt;
I recommend signing up for our free newsletter 'ACE Dev' .&lt;br&gt;
It gets delivered to your inbox and includes actionable steps and helpful resources.&lt;br&gt;
&lt;a href="https://acedev.substack.com/" rel="noopener noreferrer"&gt;Join us now&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
