<?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: Mohammed Awad</title>
    <description>The latest articles on DEV Community by Mohammed Awad (@xmohammedawad).</description>
    <link>https://dev.to/xmohammedawad</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%2F1054770%2F51b7cc61-f44c-4540-bc6d-3e1c336b6ba3.jpeg</url>
      <title>DEV Community: Mohammed Awad</title>
      <link>https://dev.to/xmohammedawad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xmohammedawad"/>
    <language>en</language>
    <item>
      <title>You Don't Know CSS Specificity: Writing Efficient CSS Code</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Fri, 06 Oct 2023 10:30:03 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/you-dont-know-css-specificity-writing-efficient-css-code-1ce0</link>
      <guid>https://dev.to/xmohammedawad/you-dont-know-css-specificity-writing-efficient-css-code-1ce0</guid>
      <description>&lt;p&gt;As web developers, we're all familiar with the fundamental role CSS plays in styling web pages. But in the ever-evolving world of web development, &lt;strong&gt;mastering the art of writing efficient and maintainable CSS code has become more crucial than ever.&lt;/strong&gt; One of the key concepts that holds the key to this mastery is CSS specificity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding the Concept&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CSS specificity is like the rulebook that determines which styles should be applied to an element when multiple styles are competing for its attention. In simpler terms, it's the referee that resolves conflicts among different style declarations for the same element. The more specific a selector is, the higher priority it receives when it comes to styling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Components of Specificity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's break down the components of specificity:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Element selectors&lt;/strong&gt; carry a specificity value of 1.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Class selectors&lt;/strong&gt; step up with a specificity of 10.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ID selectors&lt;/strong&gt; pack a punch with a specificity of 100.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inline styles&lt;/strong&gt; wield the ultimate power, with a specificity of 1000.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Example in Action&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Consider this example:&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="c"&gt;&amp;lt;!-- HTML --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;header&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"header"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"main-header"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"background-color: aqua;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&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;/header&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, we have conflicting styles applied to the header element. The background color seems like a battlefield with different specificity values vying for control.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; block provides styles for the &lt;code&gt;body&lt;/code&gt;, &lt;code&gt;.header&lt;/code&gt;, and &lt;code&gt;#main-header&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The inline style attributes add another layer of styling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When comparing specificity, remember this rule: The selector with the highest value wins. So, when an ID and a class selector go head-to-head, the ID selector takes the crown.&lt;/p&gt;

&lt;p&gt;However, there are subtleties. If two selectors have the same specificity, the one appearing later in the CSS file wins. And if a selector contains multiple instances of the same component (e.g., two class selectors), the counts are cumulative.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Practical Tools for Specificity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To make life easier, you can leverage tools like the &lt;a href="https://polypane.app/css-specificity-calculator/"&gt;Specificity Calculator&lt;/a&gt;. This tool simplifies the process of calculating specificity and even supports CSS Selectors level 4.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CSS specificity is more than a technicality; it's a superpower every web developer should harness. By following these rules of specificity and carefully selecting your selectors, you'll be able to craft efficient and maintainable CSS code that not only styles your web pages but also ensures a smooth user experience.&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
    <item>
      <title>HR Don't like Buzzwords: How Being Real Lands You the Job</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Tue, 03 Oct 2023 05:37:00 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/hr-dont-like-buzzwords-how-being-real-lands-you-the-job-3j9n</link>
      <guid>https://dev.to/xmohammedawad/hr-dont-like-buzzwords-how-being-real-lands-you-the-job-3j9n</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;In the fast-paced world of job applications and interviews, standing out is key.&lt;br&gt;
 However, there's a fine line between making a memorable impression and drowning in a sea of buzzwords.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--d9jueTUo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gcio3n9t5anea17a9y5u.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--d9jueTUo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gcio3n9t5anea17a9y5u.gif" alt="Hired " width="480" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;Here's why HR professionals are increasingly unimpressed with buzzwords and why you should ditch them too.&lt;/code&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What are Buzzwords?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Buzzwords are catchy, trendy terms or phrases that are often used in resumes, cover letters, and interviews to convey certain qualities or skills. They're designed to grab attention but often fail to provide real substance.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Most Common buzzwords&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Detail-Oriented:&lt;/strong&gt; While being detail-oriented is important, simply stating it without concrete examples doesn't provide evidence of your skills.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Team Player:&lt;/strong&gt; Everyone claims to be a team player. Instead, showcase instances of collaboration and teamwork in your work experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Self-Motivated:&lt;/strong&gt; This is expected in most job roles. Instead of saying you're self-motivated, discuss specific accomplishments or projects that demonstrate your initiative.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Results-Driven:&lt;/strong&gt; Similar to being self-motivated, it's better to show results through achievements and quantifiable data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Excellent Communication Skills:&lt;/strong&gt; Communication skills are vital, but without proof or examples, this statement lacks impact.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Innovative:&lt;/strong&gt; Mentioning that you're innovative is less effective than showcasing specific innovative projects or ideas you've contributed to.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dynamic:&lt;/strong&gt; This term is vague and doesn't convey much information. Share concrete examples of how you've adapted to changes or challenges.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hard Worker:&lt;/strong&gt; Everyone wants to work hard. Instead, discuss your work ethic through achievements and dedication to projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Detail-Oriented:&lt;/strong&gt; This is another common buzzword. Instead, demonstrate your attention to detail through specific achievements or examples.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Outside-the-Box Thinker:&lt;/strong&gt; Instead of stating this, describe instances where you've brought fresh perspectives or creative solutions to problems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ninja/Guru/Wizard:&lt;/strong&gt; These playful titles can come across as unprofessional. Stick to traditional titles and descriptions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Go-Getter:&lt;/strong&gt; While enthusiasm is great, provide examples of how your proactive attitude translated into concrete results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Synergy:&lt;/strong&gt; This corporate buzzword is often seen as jargon. Use clearer language to describe collaboration and teamwork.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Utilize:&lt;/strong&gt; Instead of saying "utilized," use more straightforward verbs like "used" or "implemented."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Best in Class:&lt;/strong&gt; This term lacks specificity and doesn't provide any context for your achievements.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;The Buzzword Backlash&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;HR professionals are growing weary of buzzwords for several reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lack of Specificity:&lt;/strong&gt; Buzzwords like "team player" or "innovative thinker" lack specificity. They don't tell the recruiter much about your actual abilities or experiences.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Overuse:&lt;/strong&gt; Buzzwords are overused to the point of becoming cliché. When every candidate claims to be a "dynamic problem solver," it loses its impact.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Empty Promises:&lt;/strong&gt; Buzzwords can come across as empty promises. Saying you're a "results-driven self-starter" means little without concrete examples to back it up.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Navigating Buzzwords in ChatGPT Conversations
&lt;/h2&gt;

&lt;p&gt;When using ChatGPT or any AI tool, beware of overusing buzzwords. These terms can make your communication seem insincere, vague, and robotic. Instead, focus on clear, context-appropriate, and personalized responses for more engaging and authentic conversations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Authenticity Matters:&lt;/strong&gt; Just as in human interactions, authenticity in conversations with AI is crucial. Overusing buzzwords can make the conversation seem robotic and insincere. It's essential to maintain a natural and genuine tone.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Clarity Over Jargon:&lt;/strong&gt; Buzzwords can be ambiguous and may not convey your message effectively. Opt for clear and straightforward language to ensure your point gets across without any confusion.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Contextual Relevance:&lt;/strong&gt; Be cautious about inserting buzzwords without considering the context. The inappropriate use of buzzwords can lead to misunderstanding or misinterpretation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Tailoring Responses:&lt;/strong&gt; ChatGPT should be a tool to assist and enhance your communication, not a crutch. Avoid relying on buzzwords to replace well-thought-out responses tailored to the specific needs of the conversation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Personalization is Key:&lt;/strong&gt; Instead of generic buzzwords, personalize your responses to create a more engaging and meaningful conversation. Addressing specific questions or concerns can lead to a more productive exchange.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Authenticity and Engagement:&lt;/strong&gt; Meaningful interactions often revolve around authenticity and engagement. Using buzzwords excessively can hinder the development of a genuine rapport with the person you're communicating with.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;The Power of Real Stories&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Instead of relying on buzzwords, focus on telling real stories. Share specific accomplishments, challenges you've overcome, and how you've added value in your previous roles.&lt;/p&gt;

&lt;p&gt;For example, instead of saying you're a "detail-oriented team player," you could say something like, "I meticulously reviewed and improved our project documentation, resulting in a 20% decrease in errors and smoother teamwork."&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Connecting on a Human Level&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;HR professionals are not just looking for a list of skills; they want to connect with you on a human level. Sharing genuine experiences and showing your personality can be far more impactful than a laundry list of buzzwords.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Now&lt;/em&gt; do you think we should use a few buzzwords or not at all?&lt;br&gt;
Did you use some of them in your resume? tell us in the comments&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




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

&lt;p&gt;While buzzwords might seem like an easy way to catch a recruiter's eye, they often have the opposite effect.&lt;/p&gt;

&lt;p&gt;HR professionals are looking for real, tangible evidence of your skills and experiences. &lt;/p&gt;

&lt;p&gt;So, next time you're tempted to sprinkle buzzwords throughout your application, think twice and opt for authenticity instead.😉&lt;/p&gt;

&lt;p&gt;As a React developer, I'm currently on the lookout for new opportunities. If you know of any roles where my experience could be a good fit, I would love to hear from you.&lt;/p&gt;

&lt;p&gt;You can reach out to me anytime at my email &lt;a href="//mailto:xMohammedAwad@gamil.com"&gt;xMohammedAwad@gamil.com&lt;/a&gt;, or connect with me on &lt;a href="https://www.linkedin.com/in/xMohammedAwad/"&gt;LinkedIn&lt;/a&gt;. Check out my projects on &lt;a href="https://github.com/xMohammedAwad"&gt;GitHub&lt;/a&gt; to see more examples of my work.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>productivity</category>
      <category>career</category>
    </item>
    <item>
      <title>How to solve medium leetcode problem?[need help]</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Fri, 29 Sep 2023 11:20:00 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/how-to-solve-medium-leetcode-problemneed-help-1771</link>
      <guid>https://dev.to/xmohammedawad/how-to-solve-medium-leetcode-problemneed-help-1771</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;I don't know if everyone has this problem but I took a long time to solve a medium problem in leetcode sometimes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I needed 10-15 minutes to understand and make some ideas and maybe can not had any idea how to start until I see hints but mostly passed with 70%-80% of the tests then gave up and used ChatGpt to get a solution. with easy questions took a couple of minutes and sometimes 20-25 minutes, depending on the idea&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For example&lt;/strong&gt; I learned about the 2-pointer technique then tried solving a problem starting with the basics and init the left and right pointers then got stuck with passing all the tests what should I do with conditions that solve the problem and pass all the tests&lt;/p&gt;

&lt;p&gt;until now I have solved 12 easy and 6 medium problems&lt;/p&gt;

&lt;p&gt;** What should I do to be better ?**&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>career</category>
      <category>interview</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>How to solve medium leetcode problem?</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Thu, 28 Sep 2023 18:43:27 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/how-to-solve-medium-leetcode-problem-cip</link>
      <guid>https://dev.to/xmohammedawad/how-to-solve-medium-leetcode-problem-cip</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;I don't know if everyone has this problem but I took a long time to solve a medium problem in leetcode sometimes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I needed 10-15 minutes to understand and make some ideas and maybe can not had any idea how to start until I see hints but mostly passed with 70%-80% of the tests then gave up and used ChatGpt to get a solution. with easy questions took a couple of minutes and sometimes 20-25 minutes, depending on the idea&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For example&lt;/strong&gt; I learned about the 2-pointer technique then tried solving a problem starting with the basics and init the left and right pointers then got stuck with passing all the tests what should I do with conditions that solve the problem and pass all the tests&lt;/p&gt;

&lt;p&gt;until now I have solved 12 easy and 6 medium problems&lt;/p&gt;

&lt;p&gt;** What should I do to be better ?**&lt;/p&gt;

</description>
    </item>
    <item>
      <title>👌 What is Git? Why do you use it? what is CIDI? git Flow or Github Flow? 10 Must-Know Questions💡🚀</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Thu, 28 Sep 2023 15:59:00 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/what-is-git-why-do-you-use-it-what-do-you-know-about-the-cidi-and-git-flow-or-github-flow-3mgb</link>
      <guid>https://dev.to/xmohammedawad/what-is-git-why-do-you-use-it-what-do-you-know-about-the-cidi-and-git-flow-or-github-flow-3mgb</guid>
      <description>&lt;h2&gt;
  
  
  Git
&lt;/h2&gt;

&lt;p&gt;is a version control system that allows multiple people to work on a project at the same time without overwriting each other's changes.&lt;/p&gt;

&lt;p&gt;It keeps track of all changes made to a project and allows you to backtrack if necessary.&lt;/p&gt;

&lt;p&gt;It's an essential tool for any developer because it encourages collaboration and ensures that your project's history is well-documented and retrievable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Commonly used Git commands include:
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git init:&lt;/code&gt; This command is used to start a new repository.&lt;br&gt;
&lt;code&gt;git clone:&lt;/code&gt; This command is used to copy a repository from a remote source to your local machine.&lt;br&gt;
&lt;code&gt;git add:&lt;/code&gt; This command is used to stage changes for a commit.&lt;br&gt;
&lt;code&gt;git commit:&lt;/code&gt; This command is used to save your changes to the local repository.&lt;br&gt;
&lt;code&gt;git push:&lt;/code&gt; This command is used to send your committed changes to a remote repository.&lt;br&gt;
&lt;code&gt;git pull:&lt;/code&gt; This command is used to fetch changes from a remote repository and merge them into your current branch.&lt;br&gt;
&lt;code&gt;git status:&lt;/code&gt; This command is used to show the status of changes as untracked, modified, or staged.&lt;br&gt;
&lt;code&gt;git branch:&lt;/code&gt; This command is used to list, create, or delete.&lt;br&gt;
 branches gist.github.com.&lt;br&gt;
CIDI stands for Continuous Integration and Continuous Delivery. It's a practice in software development where developers regularly merge their code changes into a central repository, after which automated builds and tests are run. The key goals are to find and address bugs quicker, improve software quality, and reduce the time it takes to validate and release new software updates.&lt;/p&gt;




&lt;h2&gt;
  
  
  Git Flow
&lt;/h2&gt;

&lt;p&gt;is a branching model for Git, created by Vincent Driessen. It's a solution to the problem of maintaining a stable code base when multiple developers are working on a project at once.&lt;/p&gt;

&lt;p&gt;In Git Flow, there are two main branches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;main or master&lt;/strong&gt;: This branch contains production code. All of the code that is currently in production is stored in this branch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;develop&lt;/strong&gt;: This is the branch to which all feature branches are merged, and where all tests are performed. Only when an update is considered ready for production, it is merged into the main branch docs.syntevo.com.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are also three types of supporting branches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;feature branches&lt;/strong&gt;: These are used to develop new features for the upcoming or a distant future release. When starting development of a feature, the target release in which this feature will be incorporated may well be unknown at that point.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;release branches&lt;/strong&gt;: These branches support preparation of a new production release. They allow for last-minute dotting of i’s and crossing t’s.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;hotfix branches&lt;/strong&gt;: These branches are very much like release branches in that they are also meant to prepare for a new production release, albeit unplanned. They arise from the necessity to act immediately upon an undesired state of a live production version.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  GitHub flow
&lt;/h2&gt;

&lt;p&gt;GitHub Flow is a lightweight, branch-based workflow developed and used by GitHub. It's designed to be simple and easy to understand, especially for developers who are just getting started with Git.&lt;/p&gt;

&lt;p&gt;The GitHub Flow has six steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create a branch&lt;/strong&gt;: From the repository, you create a new branch off the main branch to encapsulate your work. This is a core aspect of Git, and it allows you to work on separate tasks without affecting the main codebase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Add commits&lt;/strong&gt;: Make changes to your branch and commit them. Each commit is like a safe, small checkpoint for your work. Commit messages help document what changes were made and why.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open a Pull Request (PR)&lt;/strong&gt;: Once you have made and committed your changes, you open a Pull Request. This is where the discussion about your proposed changes happens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Discuss and review&lt;/strong&gt;: Your changes can now be reviewed by others. They can comment on your code, suggest changes, or approve the PR.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deploy&lt;/strong&gt;: If everything is fine with your changes, you can deploy your branch to verify in production.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Merge&lt;/strong&gt;: Once your changes have been reviewed and passed all tests, and you're happy with how they work in production, you can merge your changes into the main branch.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The GitHub Flow emphasizes the importance of deploying branches to production-like environments to test them before they're merged into the main branch. This allows for any necessary adjustments to be made before the code is merged into the main branch, reducing the chance of unexpected problems.&lt;/p&gt;

&lt;p&gt;It's important to note that GitHub Flow is different from Git Flow. While Git Flow has specific branches for developing, testing, and releasing, GitHub Flow simplifies this to one concurrent line of development. This makes it a popular choice for continuous deployment environments, where new changes go live as soon as they're merged.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;I would love to share a part of my preparation tips for job interview.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As a React developer, I'm currently on the lookout for new opportunities. If you know of any roles where my experience could be a good fit, I would love to hear from you.&lt;/p&gt;

&lt;p&gt;You can reach out to me anytime at my email &lt;a href="//mailto:xMohammedAwad@gamil.com"&gt;xMohammedAwad@gamil.com&lt;/a&gt;, or connect with me on &lt;a href="https://www.linkedin.com/in/xMohammedAwad/"&gt;LinkedIn&lt;/a&gt;. Check out my projects on &lt;a href="https://github.com/xMohammedAwad"&gt;GitHub&lt;/a&gt; to see more examples of my work.&lt;/p&gt;

</description>
      <category>git</category>
      <category>interview</category>
      <category>career</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>🔥What are the differences between const, let, and var? 10 Must-Know Questions for Junior Developers💡🚀</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Wed, 27 Sep 2023 15:17:00 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/what-are-the-differences-between-const-let-and-var-10-must-know-questions-for-junior-developers-2ji4</link>
      <guid>https://dev.to/xmohammedawad/what-are-the-differences-between-const-let-and-var-10-must-know-questions-for-junior-developers-2ji4</guid>
      <description>&lt;p&gt;In JavaScript, you can declare variables using &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt;, and &lt;code&gt;const&lt;/code&gt;. They differ in terms of scope, hoisting, and reassignment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Var&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before ES6, &lt;code&gt;var&lt;/code&gt; was used to declare variables. &lt;code&gt;var&lt;/code&gt; variables are either globally scoped or function scoped. A &lt;code&gt;var&lt;/code&gt; variable is globally scoped when declared outside a function and can be accessed anywhere in the code. When declared inside a function, it's function scoped and can only be accessed within that function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;greeter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hey hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// globally scoped&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;newFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// function scoped&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="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// error: hello is not defined&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In terms of reassignment, &lt;code&gt;var&lt;/code&gt; variables can be updated and re-declared within the same scope without any error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;greeter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hey hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;greeter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hello instead&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// No error&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;var&lt;/code&gt; variables are hoisted to the top of their scope and initialized with a value of &lt;code&gt;undefined&lt;/code&gt;&lt;a href="https://www.freecodecamp.org/news/var-let-and-const-whats-the-difference/"&gt;Source 0&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let&lt;/code&gt; is preferred for variable declaration since ES6. A significant difference between &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;var&lt;/code&gt; is that &lt;code&gt;let&lt;/code&gt; is block-scoped, meaning it can only be accessed within the block where it's declared.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hi&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;times&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hello instead&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="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "say Hello instead"&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="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// error: hello is not defined&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;code&gt;let&lt;/code&gt; variable can be updated but not re-declared within its scope.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hello instead&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// No error&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hello instead&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// error: Identifier 'greeting' has already been declared&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;let&lt;/code&gt; declarations, like &lt;code&gt;var&lt;/code&gt;, are hoisted to the top. However, unlike &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt; is not initialized, leading to a Reference Error if you try to use a &lt;code&gt;let&lt;/code&gt; variable before declaration&lt;a href="https://www.freecodecamp.org/news/var-let-and-const-whats-the-difference/"&gt;Source 0&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Const&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const&lt;/code&gt; is another way to declare variables. &lt;code&gt;const&lt;/code&gt; declarations are block-scoped like &lt;code&gt;let&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&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="kc"&gt;true&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;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;9&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="nx"&gt;log&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="c1"&gt;// 9&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="nx"&gt;log&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="c1"&gt;// 10&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The main difference between &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; is that &lt;code&gt;const&lt;/code&gt; variables cannot be updated or re-declared.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hello instead&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// error: Assignment to constant variable.&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hi&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;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hello instead&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// error: Identifier 'greeting' has already been declared&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, while a &lt;code&gt;const&lt;/code&gt; object cannot be updated, the properties of this object can be updated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;times&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="nx"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;say Hello instead&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// No error&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Like &lt;code&gt;let&lt;/code&gt;, &lt;code&gt;const&lt;/code&gt; declarations are hoisted to the top but are not initialized&lt;a href="https://www.freecodecamp.org/news/var-let-and-const-whats-the-difference/"&gt;Source 0&lt;/a&gt;&lt;a href="https://www.geeksforgeeks.org/difference-between-var-let-and-const-keywords-in-javascript/"&gt;Source 2&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In summary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;var&lt;/code&gt; declarations are globally scoped or function scoped, can be updated and re-declared within its scope, and are hoisted to the top and initialized with &lt;code&gt;undefined&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;let&lt;/code&gt; declarations are block-scoped, can be updated but not re-declared within its scope, and are hoisted to the top but not initialized, and you can not use it in block-scope.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;const&lt;/code&gt; declarations are block-scoped, cannot be updated or re-declared, and are hoisted to the top but not initialized.&lt;/li&gt;
&lt;/ul&gt;




&lt;blockquote&gt;
&lt;p&gt;I would love to share a part of my preparation tips for job interviews.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As a React developer, I'm currently on the lookout for new opportunities. If you know of any roles where my experience could be a good fit, I would love to hear from you.&lt;/p&gt;

&lt;p&gt;You can reach out to me anytime at my email &lt;a href="//mailto:xMohammedAwad@gamil.com"&gt;xMohammedAwad@gamil.com&lt;/a&gt;, or connect with me on &lt;a href="https://www.linkedin.com/in/xMohammedAwad/"&gt;LinkedIn&lt;/a&gt;. Check out my projects on &lt;a href="https://github.com/xMohammedAwad"&gt;GitHub&lt;/a&gt; to see more examples of my work.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>career</category>
      <category>interview</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🔥 What are falsey values in JavaScript? 10 Must-Know Questions for Junior Developers💡🚀</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Tue, 26 Sep 2023 13:15:37 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/interview-question-what-are-falsey-values-in-javascript-3c8j</link>
      <guid>https://dev.to/xmohammedawad/interview-question-what-are-falsey-values-in-javascript-3c8j</guid>
      <description>&lt;p&gt;In JavaScript, "falsy" values are values that are treated as false in Boolean contexts, such as conditional statements (&lt;code&gt;if&lt;/code&gt;, &lt;code&gt;while&lt;/code&gt;), logical operations (&lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;, &lt;code&gt;||&lt;/code&gt;, &lt;code&gt;!&lt;/code&gt;), and other areas where a Boolean value is expected. There are seven falsy values in JavaScript:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;false&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0&lt;/code&gt; and &lt;code&gt;-0&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;""&lt;/code&gt; (empty string)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;null&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;undefined&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;NaN&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;document.all&lt;/code&gt; (for historical web compatibility reasons)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Any value that is not in this list is considered "truthy". Here is an example demonstrating how JavaScript treats falsy 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;test1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="c1"&gt;// empty string&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;test2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="c1"&gt;// zero&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;test3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;parseFloat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// NaN &lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;test1&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;test2&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;test3&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="nx"&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;falsy&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="c1"&gt;// logs falsy&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;test1&lt;/code&gt;, &lt;code&gt;test2&lt;/code&gt;, and &lt;code&gt;test3&lt;/code&gt; are all falsy values, so &lt;code&gt;!test1 &amp;amp;&amp;amp; !test2 &amp;amp;&amp;amp; !test3&lt;/code&gt; returns true, and 'falsy' is logged to the console &lt;a href="https://dev.to/johnpalmgren/understanding-truthy-and-falsy-in-javascript-b82"&gt;Source 8&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It's important to note that while falsy values are treated as false in Boolean contexts, they are not the same as the Boolean value &lt;code&gt;false&lt;/code&gt;. For example, if you use the strict equality operator &lt;code&gt;===&lt;/code&gt; to compare a falsy value with &lt;code&gt;false&lt;/code&gt;, the result will be &lt;code&gt;false&lt;/code&gt;, because &lt;code&gt;===&lt;/code&gt; checks both the value and the type. Here's an example:&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;test1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="c1"&gt;// test1 is false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, &lt;code&gt;test1&lt;/code&gt; is &lt;code&gt;false&lt;/code&gt; because the empty string &lt;code&gt;""&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt; are different types (String and Boolean, respectively) &lt;a href="https://dev.to/johnpalmgren/understanding-truthy-and-falsy-in-javascript-b82"&gt;Source 8&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can convert any JavaScript value to a Boolean value using the &lt;code&gt;Boolean&lt;/code&gt; function or the &lt;code&gt;!!&lt;/code&gt; (double NOT) operator. This will return &lt;code&gt;true&lt;/code&gt; for truthy values and &lt;code&gt;false&lt;/code&gt; for falsy 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;value&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="c1"&gt;// a falsy value&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Boolean&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;// false&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&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;// false&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;value2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// a truthy value&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!!&lt;/span&gt;&lt;span class="nx"&gt;value2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now after you know what falsy values record yourself answering that question and repeating it until you succeed because explaining what you know is very important for employers or HR.&lt;/p&gt;

&lt;p&gt;I would love to share a part of my preparation tips for job interview.&lt;/p&gt;




&lt;p&gt;As a React developer, I'm currently on the lookout for new opportunities. If you know of any roles where my experience could be a good fit, I would love to hear from you.&lt;/p&gt;

&lt;p&gt;You can reach out to me anytime at my email &lt;a href="mailto:xMohammedAwad@gamil.com"&gt;xMohammedAwad@gamil.com&lt;/a&gt;, or connect with me on &lt;a href="https://www.linkedin.com/in/xMohammedAwad/"&gt;LinkedIn&lt;/a&gt;. Check out my projects on &lt;a href="https://github.com/xMohammedAwad"&gt;GitHub &lt;/a&gt;to see more examples of my work.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>interview</category>
      <category>career</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Why to Use HOCs in React</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Fri, 22 Sep 2023 22:33:45 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/what-and-why-to-use-hocs-in-react-1m8m</link>
      <guid>https://dev.to/xmohammedawad/what-and-why-to-use-hocs-in-react-1m8m</guid>
      <description>&lt;h3&gt;
  
  
  Higher-Order Components in React (HOC)
&lt;/h3&gt;

&lt;p&gt;Imagine you're a magician and you have a magic box. You can put anything into this box, say a rabbit, and the box will add a hat to it. Now, every time you pull out a rabbit, it's wearing a hat! This is what Higher-Order Components (HOCs) do in React. They're like the magic box that adds extra features or behaviors to a component.&lt;/p&gt;




&lt;h3&gt;
  
  
  What is a Higher-Order Component (HOC)?
&lt;/h3&gt;

&lt;p&gt;In React, a Higher-Order Component (HOC) is a function that takes a component as an argument and returns a new component with added features or behaviors. It's a way of reusing component logic across multiple components without modifying their code. This makes them a flexible and reusable way to add functionality to your components.&lt;/p&gt;




&lt;h3&gt;
  
  
  When and How to Use HOCs?
&lt;/h3&gt;

&lt;p&gt;In the real world, as a developer, you often find yourself writing code that is repetitive or similar in nature. This is where Higher-Order Components (HOCs) come to the rescue in React. I recently used a HOC in my project, an "Arab van"(rental system), and it greatly simplified my code by abstracting out common logic.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I had to fetch data in multiple components. Instead of repeating the fetching logic in each component, I created a Higher-Order Component (HOC) named withFetchData.&lt;/p&gt;

&lt;p&gt;Every HOC name starts by &lt;code&gt;with&lt;/code&gt; like &lt;code&gt;withFetchData&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This HOC takes a component (WrappedComponent) and a fetchData function as its arguments.&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;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;withFetchData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;WrappedComponent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&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;return&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&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;memoizedFetchData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useCallback&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;fetchData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;id&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;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;loading&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="nx"&gt;execute&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nx"&gt;memoizedFetchData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;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="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;execute&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;WrappedComponent&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&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="nx"&gt;vanId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
           &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="err"&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;And here's how you can use it:&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;EnhancedComponent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;withFetchData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MyComponent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&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;&lt;em&gt;The result is a new component (EnhancedComponent) that behaves exactly like MyComponent, but with added data fetching capabilities.&lt;/em&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Why I Chose HOC
&lt;/h3&gt;

&lt;p&gt;The reason I chose to use an HOC for this purpose was twofold:&lt;/p&gt;

&lt;p&gt;Code Reusability: By encapsulating the data fetching logic inside a HOC, I was able to reuse this logic across multiple components, thereby reducing code duplication and making the codebase cleaner and more maintainable.&lt;br&gt;
Separation of Concerns: The HOC allowed me to separate the data fetching logic from the presentation logic of my components. This made the components easier to understand, test, and maintain.&lt;/p&gt;




&lt;h3&gt;
  
  
  In conclusion,
&lt;/h3&gt;

&lt;p&gt;Higher-order components are a powerful tool in React that allows you to write cleaner, more reusable code. I found them to be incredibly useful in my "rental van app" project, and I believe they can be beneficial in many other scenarios as well.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Remember, every line of code you write is a step towards becoming a better developer. Keep learning, keep growing, and most importantly, have fun along the way!&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;As a React developer, I'm currently on the lookout for new opportunities. If you know of any roles where my experience could be a good fit, I would love to hear from you.&lt;/p&gt;

&lt;p&gt;You can reach out to me anytime at my email &lt;a href="mailto:xMohammedAwad@gamil.com"&gt;xMohammedAwad@gamil.com&lt;/a&gt;, or connect with me on &lt;a href="https://www.linkedin.com/in/xMohammedAwad/"&gt;LinkedIn&lt;/a&gt;. Check out my projects on &lt;a href="https://github.com/xMohammedAwad"&gt;GitHub &lt;/a&gt;to see more examples of my work.&lt;/p&gt;

&lt;p&gt;Muhmmad Awd&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>react</category>
      <category>newbie</category>
    </item>
    <item>
      <title>Mastering React Forms: Building Interactive User Input</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Thu, 13 Jul 2023 05:31:39 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/mastering-react-forms-building-interactive-user-input-joh</link>
      <guid>https://dev.to/xmohammedawad/mastering-react-forms-building-interactive-user-input-joh</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;React&lt;/strong&gt;, a popular JavaScript library for building user interfaces, provides powerful tools for handling user input through forms. In this article, we will explore the essentials of building interactive forms in React. &lt;strong&gt;From capturing user data&lt;/strong&gt; to handling validation and submission, we'll cover the key concepts and best practices that will help you master React forms.&lt;/p&gt;




&lt;h3&gt;
  
  
  1. Creating a Form Component
&lt;/h3&gt;

&lt;p&gt;To start, we need to create a form component in React. A form component encapsulates the form's structure and behavior. Here's an example of a simple form component:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&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;MyForm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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;formData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setFormData&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&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="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleChange&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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;value&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;setFormData&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;prevData&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;prevData&lt;/span&gt;&lt;span class="p"&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;value&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;handleSubmit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="c1"&gt;// Handle form submission logic here&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt; &lt;span class="na"&gt;onSubmit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleSubmit&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        Name:
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt;
          &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;
          &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
          &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleChange&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        Email:
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt;
          &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;
          &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
          &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleChange&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        Message:
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;textarea&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"message"&lt;/span&gt;
          &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
          &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleChange&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;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;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;MyForm&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h3&gt;
  
  
  2. Handling Form Input and State
&lt;/h3&gt;

&lt;p&gt;In React, form input elements are controlled components. We store the form data in the component's state and update it using the &lt;code&gt;handleChange&lt;/code&gt; function. The &lt;code&gt;handleChange&lt;/code&gt; function uses the &lt;code&gt;name&lt;/code&gt; attribute of each input element to identify the corresponding property in the &lt;code&gt;formData&lt;/code&gt; state object.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Form Validation
&lt;/h3&gt;

&lt;p&gt;Validating user input is a crucial part of form handling. React provides several options for form validation, such as using third-party libraries like Formik or Yup. Here's an example of simple validation using built-in JavaScript methods:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleSubmit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;// Perform validation&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;formData&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="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;()&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="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Handle name validation error&lt;/span&gt;
    &lt;span class="k"&gt;return&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="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@&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="c1"&gt;// Handle email validation error&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Form data is valid, proceed with submission&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h3&gt;
  
  
  4. Form Submission and Data Handling
&lt;/h3&gt;

&lt;p&gt;Upon form submission, we can perform actions such as sending the form data to a server, updating application state, or displaying a success message. In the &lt;code&gt;handleSubmit&lt;/code&gt; function, you can implement the desired logic based on your application's requirements.&lt;/p&gt;




&lt;h3&gt;
  
  
  5. Enhancing User Experience
&lt;/h3&gt;

&lt;p&gt;To enhance the user experience, you can add features like real-time validation, displaying error messages, and providing feedback while the user fills out the form. Consider using libraries like React Hook Form or Formik for more advanced form handling and validation features.&lt;/p&gt;







&lt;blockquote&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Currently seeking new opportunities&lt;/strong&gt;, Muhmmad is actively looking for a role where they can contribute their skills and knowledge in building cutting-edge web applications using React.js.
&lt;/h2&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;About Muhmmad:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Muhmmad is a passionate software engineer with expertise in frontend development and a strong affinity for React.&lt;/p&gt;

&lt;p&gt;Muhmmad enjoys sharing knowledge and helping fellow developers grow. Connect with Muhmmad to stay updated with the latest in frontend development.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Follow &lt;strong&gt;&lt;em&gt;Muhmmad Awd&lt;/em&gt;&lt;/strong&gt; on:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;a href="https://www.linkedin.com/in/muhmmadawd" rel="noopener noreferrer"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2FLinkedIn-0077B5%3Fstyle%3Dfor-the-badge%26logo%3Dlinkedin%26logoColor%3Dwhite" alt="LinkedIn"&gt;
      &lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;a href="https://github.com/MuhmmadAwd" rel="noopener noreferrer"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2FGitHub-100000%3Fstyle%3Dfor-the-badge%26logo%3Dgithub%26logoColor%3Dwhite" alt="GitHub"&gt;
      &lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;a href="mailto:muhmmad.awd@gmail.com"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2FGmail-D14836%3Fstyle%3Dfor-the-badge%26logo%3Dgmail%26logoColor%3Dwhite" alt="Gmail"&gt;
      &lt;/a&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>كل عام وانتم بخير - eid adha mubarak</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Tue, 27 Jun 2023 21:48:16 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/kl-m-wntm-bkhyr-eid-adha-mubarak-p30</link>
      <guid>https://dev.to/xmohammedawad/kl-m-wntm-bkhyr-eid-adha-mubarak-p30</guid>
      <description>&lt;h2&gt;
  
  
  عيد اضحى مبارك وكل عام وانتم بالف خير
&lt;/h2&gt;

&lt;p&gt;eid adha mubarak&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Map Or Object with Computed Properties</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Fri, 16 Jun 2023 16:52:57 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/map-or-object-with-computed-properties-57nh</link>
      <guid>https://dev.to/xmohammedawad/map-or-object-with-computed-properties-57nh</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;If you don't know about Computed properties check out my past article on &lt;a href="https://dev.to/muhmmadawd/what-the-heck-is-computed-properties-in-javascript-3aca"&gt;What the heck is Computed Properties in JavaScript&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Computed properties in JavaScript provide an elegant solution to handle such scenarios. In this article, we'll explore computed properties and discuss their usage in two common data structures: Map and Object. We'll also discuss when to choose one over the other based on specific requirements.&lt;/p&gt;




&lt;h3&gt;
  
  
  1. Introduction to Computed Properties
&lt;/h3&gt;

&lt;p&gt;Computed properties, introduced in ECMAScript 2015 (ES6), allow you to create object properties dynamically using an expression in square brackets (&lt;code&gt;[]&lt;/code&gt;). Instead of specifying a fixed property name, you can use an expression to compute the property name at runtime. This provides flexibility in working with object properties and enables dynamic behaviors.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Computed Properties in Objects
&lt;/h3&gt;

&lt;p&gt;In JavaScript, objects are a fundamental data structure used to store and manipulate data. Computed properties can be used in objects to dynamically create or access properties.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&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;propertyName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dynamicPropertyName&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;obj&lt;/span&gt; &lt;span class="o"&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;propertyName&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;code&gt;propertyName&lt;/code&gt; variable contains the computed property name, which is enclosed in square brackets within the object literal. The value assigned to the computed property can be any valid JavaScript expression.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Maps
&lt;/h3&gt;

&lt;p&gt;Maps are another data structure introduced in ES6 that provide a way to store key-value pairs. Unlike objects, which only allow string or symbol keys, Maps support any data type as a key. Computed properties can also be utilized in Maps to dynamically handle keys and values.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&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;map&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&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;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dynamicKey&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dynamicValue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;code&gt;key&lt;/code&gt; variable contains the computed key value, and the &lt;code&gt;value&lt;/code&gt; variable represents the associated value. By using the &lt;code&gt;set&lt;/code&gt; method, we can dynamically assign values to map entries.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Choosing Between Map and Object with Computed Properties
&lt;/h3&gt;

&lt;p&gt;When deciding between Map and Object with computed properties, consider the following factors:&lt;/p&gt;

&lt;h4&gt;
  
  
  Use Case:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;If you need to associate arbitrary data types as keys or require more flexibility in key-value pair manipulation, Maps are the better choice.&lt;/li&gt;
&lt;li&gt;If you primarily work with string keys and simple data structures, objects with computed properties can suffice.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Performance:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Maps provide efficient operations for adding, removing, and searching entries, making them suitable for scenarios requiring frequent modifications.&lt;/li&gt;
&lt;li&gt;Objects are generally faster when it comes to direct property access using fixed keys.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Compatibility:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;If you're targeting older JavaScript environments or have compatibility concerns, objects with computed properties have better support across different platforms.&lt;/li&gt;
&lt;/ul&gt;




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

&lt;p&gt;In JavaScript, both Map and Object with computed properties offer powerful capabilities for dynamically assigning values and handling dynamic property names. Understanding the differences between the two will help you make an informed decision based on your specific requirements.&lt;/p&gt;

&lt;p&gt;When choosing between Map and Object, consider the use case, performance needs, and compatibility considerations. Both options have their strengths and are designed to address different scenarios effectively.&lt;/p&gt;

&lt;p&gt;We hope this article has provided clarity on the choice between Map and Object with computed properties. Happy coding!&lt;/p&gt;

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




&lt;p&gt;&lt;strong&gt;About the Author:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Muhmmad is a passionate JavaScript,&lt;br&gt;
With a strong understanding of JavaScript concepts and a love for elegant code.&lt;/p&gt;

&lt;p&gt;Muhmmad enjoys sharing knowledge and helping fellow developers improve their coding skills.&lt;/p&gt;

&lt;p&gt;Connect with Muhmmad on LinkedIn to stay updated with his latest articles and projects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Follow &lt;strong&gt;&lt;em&gt;Muhmmad Awd&lt;/em&gt;&lt;/strong&gt; on:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;a href="https://www.linkedin.com/in/muhmmadawd"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bpeFljpm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.shields.io/badge/LinkedIn-0077B5%3Fstyle%3Dfor-the-badge%26logo%3Dlinkedin%26logoColor%3Dwhite" alt="LinkedIn" width="107" height="28"&gt;
      &lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;a href="https://github.com/MuhmmadAwd"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X0Hgo7Mj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.shields.io/badge/GitHub-100000%3Fstyle%3Dfor-the-badge%26logo%3Dgithub%26logoColor%3Dwhite" alt="GitHub" width="92" height="28"&gt;
      &lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;a href="mailto:muhmmad.awd@gmail.com"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wpnqfz5P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.shields.io/badge/Gmail-D14836%3Fstyle%3Dfor-the-badge%26logo%3Dgmail%26logoColor%3Dwhite" alt="Gmail" width="83" height="28"&gt;
      &lt;/a&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What the heck is Computed Properties in JavaScript</title>
      <dc:creator>Mohammed Awad</dc:creator>
      <pubDate>Fri, 16 Jun 2023 16:42:03 +0000</pubDate>
      <link>https://dev.to/xmohammedawad/what-the-heck-is-computed-properties-in-javascript-3aca</link>
      <guid>https://dev.to/xmohammedawad/what-the-heck-is-computed-properties-in-javascript-3aca</guid>
      <description>&lt;p&gt;*&lt;em&gt;Have you ever come across situations where you need to dynamically assign values to object properties *&lt;/em&gt; or perform computations based on dynamic property names?&lt;/p&gt;

&lt;h4&gt;
  
  
  if Yes
&lt;/h4&gt;

&lt;p&gt;Computed properties in JavaScript provide an elegant solution to handle such scenarios. In this article, we'll explore computed properties, how they work, and how they can be leveraged effectively in your JavaScript code.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;*&lt;em&gt;before we start *&lt;/em&gt;&lt;br&gt;
we will discuss &lt;a href="https://dev.to/muhmmadawd/map-or-object-with-computed-properties-57nh"&gt;Choosing Between Map and Object with Computed Properties&lt;/a&gt; in the next article.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  1. Introduction to Computed Properties
&lt;/h3&gt;

&lt;p&gt;Computed properties, introduced in ECMAScript 2015 (ES6), allow you to create object properties dynamically using an expression in square brackets (&lt;code&gt;[]&lt;/code&gt;). Instead of specifying a fixed property name, you can use an expression to compute the property name at runtime. This provides flexibility in working with object properties and enables dynamic behaviors.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Syntax and Usage
&lt;/h3&gt;

&lt;p&gt;The syntax for computed properties is as follows:&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;propertyName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dynamicPropertyName&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;obj&lt;/span&gt; &lt;span class="o"&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;propertyName&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In this example, the &lt;code&gt;propertyName&lt;/code&gt; variable contains the computed property name, which is enclosed in square brackets within the object literal. The value assigned to the computed property can be any valid JavaScript expression.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Dynamic Property Names
&lt;/h3&gt;

&lt;p&gt;One common use case for computed properties is when you have dynamic property names. Consider the following example:&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;createPerson&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="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&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="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;`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;Adult`&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&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;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createPerson&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="mi"&gt;25&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;person&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 code snippet, the &lt;code&gt;createPerson&lt;/code&gt; function takes in &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;age&lt;/code&gt; parameters and returns an object with properties for &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;age&lt;/code&gt;, and a computed property &lt;code&gt;[&lt;/code&gt;is${name}Adult&lt;code&gt;]&lt;/code&gt; that indicates whether the person is an adult based on their age.&lt;/p&gt;

&lt;p&gt;By using a computed property name, we can create a dynamic property that reflects the person's name and their adult status. This approach allows for flexibility in constructing object properties based on dynamic values or conditions.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Dynamic Property Assignment
&lt;/h3&gt;

&lt;p&gt;Computed properties can also be used to dynamically assign values to object properties. Consider the following example:&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;createProduct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&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;price&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;product&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;
  &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&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;price&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;product&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;productId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ABC123&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;productData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createProduct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;productId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sample Product&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;9.99&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;productData&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;createProduct&lt;/code&gt; function takes in an &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;name&lt;/code&gt;, and &lt;code&gt;price&lt;/code&gt; and creates a product object. The computed property assignment &lt;code&gt;product[id]&lt;/code&gt; dynamically assigns the object containing the &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;price&lt;/code&gt; properties to the &lt;code&gt;id&lt;/code&gt; property of the &lt;code&gt;product&lt;/code&gt; object.&lt;/p&gt;

&lt;p&gt;By using computed properties for assignment, we can handle dynamic values as property keys, allowing for more flexible and customizable object structures.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Benefits of Computed Properties
&lt;/h3&gt;

&lt;p&gt;Computed properties offer several benefits in JavaScript programming:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dynamic Property Handling&lt;/strong&gt;: Computed properties allow for dynamic property names and assignments, enabling more flexible object structures based on runtime conditions or dynamic values.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code Readability and Maintainability&lt;/strong&gt;: By using computed properties, you can create concise and readable code, especially when dealing with dynamic property names or values. This improves code maintainability by reducing the need for explicit if-else or switch statements for property assignments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code Reusability&lt;/strong&gt;: Computed properties facilitate the creation of reusable code blocks that can handle different dynamic scenarios. Instead of writing separate code logic for each property assignment, computed properties allow you to handle dynamic cases with a single code block.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. Conclusion
&lt;/h3&gt;

&lt;p&gt;Computed properties in JavaScript provide a powerful mechanism for dynamically assigning property names and&lt;/p&gt;

&lt;p&gt;values. By using square brackets with expressions, you can create more flexible and adaptable object structures. Computed properties enhance code readability, maintainability, and reusability by handling dynamic scenarios with ease.&lt;/p&gt;

&lt;p&gt;In this article, we explored the syntax and usage of computed properties in JavaScript. We discussed their benefits and demonstrated how they can be used to handle dynamic property names and assignments effectively.&lt;/p&gt;

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




&lt;p&gt;&lt;strong&gt;About the Author:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Muhmmad is a passionate JavaScript,&lt;br&gt;
With a strong understanding of JavaScript concepts and a love for elegant code.&lt;/p&gt;

&lt;p&gt;Muhmmad enjoys sharing knowledge and helping fellow developers improve their coding skills.&lt;/p&gt;

&lt;p&gt;Connect with Muhmmad on LinkedIn to stay updated with his latest articles and projects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Follow &lt;strong&gt;&lt;em&gt;Muhmmad Awd&lt;/em&gt;&lt;/strong&gt; on:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;a href="https://www.linkedin.com/in/muhmmadawd" rel="noopener noreferrer"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2FLinkedIn-0077B5%3Fstyle%3Dfor-the-badge%26logo%3Dlinkedin%26logoColor%3Dwhite" alt="LinkedIn"&gt;
      &lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;a href="https://github.com/MuhmmadAwd" rel="noopener noreferrer"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2FGitHub-100000%3Fstyle%3Dfor-the-badge%26logo%3Dgithub%26logoColor%3Dwhite" alt="GitHub"&gt;
      &lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;a href="mailto:muhmmad.awd@gmail.com"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2FGmail-D14836%3Fstyle%3Dfor-the-badge%26logo%3Dgmail%26logoColor%3Dwhite" alt="Gmail"&gt;
      &lt;/a&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>react</category>
    </item>
  </channel>
</rss>
