<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Jessica Wilkins - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Jessica Wilkins - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Mon, 25 May 2026 10:48:42 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/devAndMusician/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ freeCodeCamp's New Relational Databases Certification is Now Live ]]>
                </title>
                <description>
                    <![CDATA[ The freeCodeCamp community just published our new Relational Databases certification. You can now sit for the exam to earn the free verified certification, which you can add to your résumé, CV, or LinkedIn profile. Each certification is filled with h... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/freecodecamps-new-relational-databases-certification-is-now-live/</link>
                <guid isPermaLink="false">694595068a4df0c53d579475</guid>
                
                    <category>
                        <![CDATA[ freeCodeCamp.org ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Databases ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Certification ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Relational Database ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Fri, 19 Dec 2025 18:10:14 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1765839442063/a5db9c4a-cb34-468b-b097-e4257803c29d.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The freeCodeCamp community just published our new <a target="_blank" href="https://www.freecodecamp.org/learn/relational-databases-v9/">Relational Databases certification</a>. You can now sit for the exam to earn the free verified certification, which you can add to your résumé, CV, or LinkedIn profile.</p>
<p>Each certification is filled with hundreds of hours worth of interactive lessons, workshops, labs, and quizzes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764617660453/0be3ab2b-90e9-4881-be81-47af607de2df.png" alt="List of modules for the Relational Databases Certification." class="image--center mx-auto" width="1688" height="1436" loading="lazy"></p>
<h2 id="heading-how-does-the-new-relational-databases-certification-work">How Does the New Relational Databases Certification Work?</h2>
<p>The new <a target="_blank" href="https://www.freecodecamp.org/learn/relational-databases-v9/">Relational Databases certification</a> will teach you core concepts including Bash scripting, SQL, Git, and more.</p>
<p>The certification is broken down into several modules that include lessons, workshops, labs, review pages, and quizzes to ensure that you truly understand the material before moving onto the next module.</p>
<p>The lessons are your first exposure to new concepts. They provide crucial theory and context for how things work in the software development industry.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764618152249/1b623cef-11d4-4ad2-9598-b273050db80f.png" alt="Example text from command line lesson" class="image--center mx-auto" width="2240" height="928" loading="lazy"></p>
<p>At the end of each lesson, there will be three comprehension check questions to test your understanding of the material from the lesson.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764618208440/7da0832d-b3a9-4e12-b21d-5215dcc48c13.png" alt="Example comprehension check question from the command line lesson." class="image--center mx-auto" width="1602" height="732" loading="lazy"></p>
<p>After the lesson blocks, you will do the workshops. These workshops are guided step-based projects that provide you with an opportunity to practice what you have learned in the lessons.</p>
<p>These workshops will not be done inside the regular freeCodeCamp editor in the browser. Instead you will need to do these workshops in one of three environments:</p>
<ul>
<li><p>GitHub Codespaces: This course runs in a virtual Linux machine using GitHub Codespaces.</p>
</li>
<li><p>Your own local environment: This course runs in a virtual Linux machine on your computer.</p>
</li>
<li><p>Ona: This course runs in a virtual Linux machine using Ona.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764639433422/09fb0695-42d6-4678-b2c1-1532eb840675.png" alt="Step 1 for the Build a Database of Video Game Characters workshop" class="image--center mx-auto" width="3014" height="828" loading="lazy"></p>
<p>After the workshop, you will complete a lab which will help you review what you have learned so far. This will give you chance to start building projects on your own, which is a crucial skill for a developer. You will be presented with a list of users stories and will need to pass the tests to complete the lab.</p>
<p>At the end of each module, there is a review page containing a list of all of the concepts covered. You can use these review pages to help you study for the quizzes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1765815540302/7ad0cadc-f94d-4b80-b35e-e46b756fd407.png" alt="Example review page from the Bash and SQL module" class="image--center mx-auto" width="1740" height="1194" loading="lazy"></p>
<p>The last portion of the module is the quiz. This is a 20 question multiple choice quiz designed to test your understanding from the material covered in the module. You will need to get 18 out of 20 correct to pass.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1765815587496/8878215f-9799-4259-ae3f-44d7101fba72.png" alt="Sample question from the Git Quiz." class="image--center mx-auto" width="1758" height="1142" loading="lazy"></p>
<p>Throughout the certification, there will be five certification projects you will need to complete in order to qualify for the exam.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1765815626782/6839bfa8-1d6f-4425-8a6e-f4dfbd3f9581.png" alt="List of certification projects for the Relational Databases Certification." class="image--center mx-auto" width="1708" height="1296" loading="lazy"></p>
<p>Once you’ve completed all 5 certification projects, you’ll be able to take the 50 question exam using our new open source exam environment. The freeCodeCamp community designed this exam environment tool with two goals: respecting your privacy while also making it harder for people to cheat.</p>
<p>Once you download the app to your laptop or desktop, you can take the exam.</p>
<h2 id="heading-frequently-asked-questions">Frequently Asked Questions</h2>
<h3 id="heading-is-all-of-this-really-free">Is all of this really free?</h3>
<p>Yes. freeCodeCamp has always been free, and we’ve now offered free verified certifications for more than a decade. These exams are just the latest expansion to our community’s free learning resources.</p>
<h3 id="heading-what-prevents-people-from-just-cheating-on-the-exams">What prevents people from just cheating on the exams?</h3>
<p>Our goal is to strike a balance between preventing cheating and respecting people's right to privacy.</p>
<p>We've implemented a number of reliable, yet non-invasive, measures to help prevent people from cheating on freeCodeCamp's exams:</p>
<ol>
<li><p>For each exam, we have a massive bank of questions and potential answers to those questions. Each time a person attempts an exam, they'll see only a small, randomized sampling of these questions.</p>
</li>
<li><p>We only allow people to attempt an exam one time per week. This reduces their ability to "brute force" the exam.</p>
</li>
<li><p>We have security in place to validate exam submissions and prevent man-in-the-middle attacks or manipulation of the exam environment.</p>
</li>
<li><p>We manually review each passing exam for evidence of cheating. Our exam environment produces tons of metrics for us to draw from.</p>
</li>
</ol>
<p>We take cheating, and any form of academic dishonesty, seriously. We will act decisively.</p>
<p>This said, no one's exam results will be thrown out without human review, and no one's account will be banned without warning based on a single suspicious exam result.</p>
<h3 id="heading-are-these-exams-open-book-or-closed-book">Are these exams “open book” or “closed book”?</h3>
<p>All of freeCodeCamp’s exams are “closed book”, meaning you must rely only on your mind and not outside resources.</p>
<p>Of course, in the real world you’ll be able to look things up. And in the real world, we encourage you to do so.</p>
<p>But that is not what these exams are evaluating. These exams are instead designed to test your memory of details and your comprehension of concepts.</p>
<p>So when taking these exams, do not use outside assistance in the form of books, notes, AI tools, or other people. Use of any of these will be considered academic dishonesty.</p>
<h3 id="heading-do-you-record-my-webcam-microphone-or-require-me-to-upload-a-photo-of-my-personal-id">Do you record my webcam, microphone, or require me to upload a photo of my personal ID?</h3>
<p>No. We considered adding these as additional test-taking security measures. But we have less privacy-invading methods of detecting most forms of academic dishonesty.</p>
<h3 id="heading-if-the-environment-is-open-source-doesnt-that-make-it-less-secure">If the environment is open source, doesn't that make it less secure?</h3>
<p>"Given enough eyeballs, all bugs are shallow." – Linus’s Law, formulated by Eric S. Raymond in his book <em>The Cathedral and the Bazaar</em></p>
<p>Open source software projects are often more secure than their closed source equivalents. This is because a lot more people are scrutinizing the code. And a lot more people can potentially help identify bugs and other deficiencies, then fix them.</p>
<p>We feel confident that open source is the way to go for this exam environment system.</p>
<h3 id="heading-how-can-i-contribute-to-the-exam-environment-codebase">How can I contribute to the Exam Environment codebase?</h3>
<p>It's fully open source, and we'd welcome your code contributions. Please read our general <a target="_blank" href="https://contribute.freecodecamp.org/intro/">contributor onboarding documentation</a>.</p>
<p>Then check out the <a target="_blank" href="https://github.com/freeCodeCamp/exam-env">GitHub repo</a>.</p>
<p>You can help by creating issues to report bugs or request features.</p>
<p>You can also browse open <code>help wanted</code> issues and attempt to open pull requests addressing them.</p>
<h3 id="heading-are-the-exam-questions-themselves-open-source">Are the exam questions themselves open source?</h3>
<p>For obvious exam security reasons, the exam question banks themselves are not publicly accessible. :)</p>
<p>These are built and maintained by freeCodeCamp's staff instructional designers.</p>
<h3 id="heading-what-happens-if-i-have-internet-connectivity-issues-mid-exam">What happens if I have internet connectivity issues mid-exam?</h3>
<p>If you have internet connectivity issues mid exam, the next time you try submit an answer, you’ll be told there are connectivity issues. The system will keep prompting you to retry submitting until the connection succeeds.</p>
<h3 id="heading-what-if-my-computer-crashes-mid-exam">What if my computer crashes mid-exam?</h3>
<p>If your computer crashes mid exam, you’ll be able to re-open the Exam Environment. Then, if you still have time left for your exam attempt, you’ll be able to continue from where you left off.</p>
<h3 id="heading-can-i-take-exams-in-languages-other-than-english">Can I take exams in languages other than English?</h3>
<p>Not yet. We’re working to add multi-lingual support in the future.</p>
<h3 id="heading-i-have-completed-my-exam-why-cant-i-see-my-results-yet">I have completed my exam. Why can't I see my results yet?</h3>
<p>All exam attempts are reviewed by freeCodeCamp staff before we release the results. We do this to ensure the integrity of the exam process and to prevent cheating. Once your attempt has been reviewed, you'll be notified of your results the next time you log in to freeCodeCamp.org.</p>
<h3 id="heading-i-am-deaf-or-hard-of-hearing-can-i-still-take-the-exams">I am Deaf or hard of hearing. Can I still take the exams?</h3>
<p>Yes! While some exams may include audio components, we do make written transcripts available for reading.</p>
<h3 id="heading-i-am-blind-or-have-limited-vision-and-use-a-screen-reader-can-i-still-take-the-exams">I am blind or have limited vision, and use a screen reader. Can I still take the exams?</h3>
<p>We’re working on it. Our curriculum is fully screen reader accessible. We're still refining our screen reader usability for the Exam Environment app. This is a high priority for us.</p>
<h3 id="heading-i-use-a-keyboard-instead-of-a-mouse-can-i-navigate-the-exams-using-just-a-keyboard">I use a keyboard instead of a mouse. Can I navigate the exams using just a keyboard?</h3>
<p>This is a high priority for us. We hope to add keyboard navigation to the Exam Environment app soon.</p>
<h3 id="heading-are-exams-timed">Are exams timed?</h3>
<p>Yes, exams are timed. We err on the side of giving plenty of time to take the exam, to account for people who are non-native English speakers, or who have ADHD and other learning differences that can make timed exams more challenging.</p>
<p>If you have a condition that usually qualifies you for extra time on standardized exams, please email support@freecodecamp.org. We’ll review your request and see whether we can find a reasonable solution.</p>
<h3 id="heading-what-happens-if-i-fail-the-exam-can-i-retake-it">What happens if I fail the exam? Can I retake it?</h3>
<p>Yes. You get one exam attempt per week. After you attempt an exam, there is a one-week (exactly 168 hour) “cool-down” period where you cannot take any freeCodeCamp exams. This is to encourage you to study and to pace yourself.</p>
<p>There is no limit to the number of times you can take an exam. So if you fail, study more, practice your skills more, then try again the following week.</p>
<h3 id="heading-do-i-need-to-redo-the-projects-if-i-fail-the-exam">Do I need to redo the projects if I fail the exam?</h3>
<p>No. Once you’ve submitted a certification project, you do not need to ever submit it again.</p>
<p>You can re-do projects for practice, but we recommend that you instead build some of our many practice projects in freeCodeCamp’s developer interview job search section.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764629117812/35c0c09a-3131-4c01-8b97-d5c101912f9e.png" alt="A screenshot of the &quot;Prepare for the developer interview job search&quot; section with lots of coding projects" width="1562" height="958" loading="lazy"></p>
<h3 id="heading-what-happens-if-i-already-have-the-old-legacy-responsive-web-design-certification-should-i-claim-the-new-one">What happens if I already have the old Legacy Responsive Web Design certification? Should I claim the new one?</h3>
<p>The new certification has more theory and practice as well as an exam. So if you’re looking to brush up on your skills, then you can go through the new version of this certification.</p>
<h3 id="heading-what-will-happen-to-my-existing-coursework-progress-on-the-full-stack-certification-does-it-transfer-over-to-the-responsive-web-design-course">What will happen to my existing coursework progress on the Full Stack Certification? Does it transfer over to the Responsive Web Design course?</h3>
<p>If you’ve already started the <a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Certified Full Stack Developer Curriculum</a>, all of your previously completed work should already be saved there.</p>
<p>To be clear, we’ve copied over all of the coursework from the full stack certification to this newer certification.</p>
<h3 id="heading-can-i-still-continue-with-the-current-full-stack-developer-certification-and-just-not-do-the-new-certification">Can I still continue with the current Full Stack Developer Certification and just not do the new certification?</h3>
<p>We’ve moved the coursework for the <a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Full Stack Developer Certification</a> over and broken it up into smaller certifications. Currently there are seven courses available for you to go through. Here is the complete list:</p>
<ul>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/responsive-web-design-v9/">Responsive Web Design Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/javascript-v9/">JavaScript Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/front-end-development-libraries-v9/">Frontend Libraries Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/python-v9/">Python Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/relational-databases-v9/">Relational Databases Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/back-end-development-and-apis-v9/">Backend JavaScript Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Certified Full Stack Developer Certification</a></p>
</li>
</ul>
<p>The Certified Full Stack Developer Certification button will remain on the learn page for a short time to give people the opportunity to switch over to the new certifications. Over the next few months, though, this option will disappear.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763050732251/0276ffab-bd3f-46fe-bac0-a654ddfafcb5.png" alt="List of all certifications on the freeCodeCamp learn page." width="1834" height="1324" loading="lazy"></p>
<h3 id="heading-will-my-legacy-certifications-become-invalid">Will my legacy certifications become invalid?</h3>
<p>No. Once you claim a certification, it’s yours to keep.</p>
<p>Also note that we previously announced that freeCodeCamp certifications would have an expiration date and require recertification. We don’t plan to implement this anytime soon. And if we do decide to, we will give everyone at least a year’s notice.</p>
<h3 id="heading-will-the-exam-be-available-to-take-on-my-phone">Will the exam be available to take on my phone?</h3>
<p>At this time, no. You’ll need to use a laptop or desktop to download the exam environment and take the exam. We hope to eventually offer these certification exams on iPhone and Android.</p>
<h3 id="heading-i-have-a-disability-or-health-condition-that-is-not-covered-here-how-can-i-request-accommodations">I have a disability or health condition that is not covered here. How can I request accommodations?</h3>
<p>If you need specific accommodations for the exam (for example extra time, breaks, or alternative formats), please email support@freecodecamp.org. We’ll review your request and see whether we can find a reasonable solution.</p>
<h2 id="heading-anything-else">Anything else?</h2>
<p>Good luck working through freeCodeCamp’s coursework, building projects, and preparing for these exams.</p>
<p>Happy coding!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ freeCodeCamp's New Python Certification is Now Live ]]>
                </title>
                <description>
                    <![CDATA[ The freeCodeCamp community just published our new Python certification. You can now sit for the exam to earn the free verified certification, which you can add to your résumé, CV, or LinkedIn profile. Each certification is filled with hundreds of hou... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/freecodecamps-new-python-certification-is-now-live/</link>
                <guid isPermaLink="false">6940200b3e9f58ff90228d6c</guid>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                    <category>
                        <![CDATA[ freeCodeCamp.org ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Mon, 15 Dec 2025 14:49:47 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1765407487534/39d17b0d-bdb1-44c4-b330-2222a45cea91.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The freeCodeCamp community just published our new <a target="_blank" href="https://www.freecodecamp.org/learn/python-v9/">Python certification</a>. You can now sit for the exam to earn the free verified certification, which you can add to your résumé, CV, or LinkedIn profile.</p>
<p>Each certification is filled with hundreds of hours worth of interactive lessons, workshops, labs, and quizzes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764612408127/5ff176a2-3a3e-4a91-b88e-4d08d55cd89d.png" alt="List of Python modules in the new Python certification" class="image--center mx-auto" width="1654" height="1446" loading="lazy"></p>
<h2 id="heading-how-does-the-new-python-certification-work">How Does the New Python Certification Work?</h2>
<p>The new <a target="_blank" href="https://www.freecodecamp.org/learn/python-v9/">Python certification</a> will teach you core concepts including functions, loops, dictionaries, sets, classes, data structures, algorithms, and more.</p>
<p>The certification is broken down into several modules that include lessons, workshops, labs, review pages, and quizzes to ensure that you truly understand the material before moving onto the next module.</p>
<p>The lessons are your first exposure to new concepts. They provide crucial theory and context for how things work in the software development industry.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764612525177/a4cb78e1-21ce-4775-998a-8f91c4f9b313.png" alt="Example from a Python basics lesson page." class="image--center mx-auto" width="1690" height="790" loading="lazy"></p>
<p>At the end of each lesson, there will be three comprehension check questions to test your understanding of the material from the lesson.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764612754911/33a917ad-9a67-4d9c-bd5c-b8c80822487d.png" alt="Example question from the Working with Strings lesson." class="image--center mx-auto" width="1656" height="720" loading="lazy"></p>
<p>After the lesson blocks, you will do the workshops. These workshops are guided step-based projects that provide you with an opportunity to practice what you have learned in the lessons.</p>
<p>You do not need to install a separate application to run your Python code. We have a custom Python editor that runs Python code in the browser.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764612847396/4192e64d-e0a0-4b5e-b061-96830c8f3a0f.png" alt="Example step from the Build a Linked List workshop." class="image--center mx-auto" width="3000" height="1082" loading="lazy"></p>
<p>After the workshops, you will complete a lab which will help you review what you have learned so far. This will give you chance to start building projects on your own, which is a crucial skill for a developer. You will be presented with a list of users stories and will need to pass the tests to complete the lab</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764612902623/f01cde2c-780b-4ff3-96d6-8e86e7fd3e87.png" alt="Example user stories for the Implement the Luhn Algorithm lab." class="image--center mx-auto" width="3016" height="1446" loading="lazy"></p>
<p>At the end of each module, there is a review page containing a list of all of the concepts covered. You can use these review pages to help you study for the quizzes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764612943611/310af31f-099c-4fcb-af7e-c702da775968.png" alt="Portions from the Object Oriented Programming review page." class="image--center mx-auto" width="1666" height="592" loading="lazy"></p>
<p>The last portion of the module is the quiz. This is a 20 question multiple choice quiz designed to test your understanding from the material covered in the module. You will need to get 18 out of 20 correct to pass.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764613010825/aa3a7881-a54b-4f3f-b402-cb5a8bd983dc.png" alt="Example question on graphs from the Graphs and Trees quiz." class="image--center mx-auto" width="1810" height="1270" loading="lazy"></p>
<p>Throughout the certification, there will be five certification projects you will need to complete in order to qualify for the exam.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764613045820/c6b7f5c4-4d9b-4058-a712-2f2ae3d2b032.png" alt="List of certification projects in the new Python certification" class="image--center mx-auto" width="1670" height="1352" loading="lazy"></p>
<p>Once you’ve completed all 5 certification projects, you’ll be able to take the 50 question exam using our new open source exam environment. The freeCodeCamp community designed this exam environment tool with two goals: respecting your privacy while also making it harder for people to cheat.</p>
<p>Once you download the app to your laptop or desktop, you can take the exam.</p>
<h2 id="heading-frequently-asked-questions"><strong>Frequently Asked Questions</strong></h2>
<h3 id="heading-is-all-of-this-really-free">Is all of this really free?</h3>
<p>Yes. freeCodeCamp has always been free, and we’ve now offered free verified certifications for more than a decade. These exams are just the latest expansion to our community’s free learning resources.</p>
<h3 id="heading-what-prevents-people-from-just-cheating-on-the-exams">What prevents people from just cheating on the exams?</h3>
<p>Our goal is to strike a balance between preventing cheating and respecting people's right to privacy.</p>
<p>We've implemented a number of reliable, yet non-invasive, measures to help prevent people from cheating on freeCodeCamp's exams:</p>
<ol>
<li><p>For each exam, we have a massive bank of questions and potential answers to those questions. Each time a person attempts an exam, they'll see only a small, randomized sampling of these questions.</p>
</li>
<li><p>We only allow people to attempt an exam one time per week. This reduces their ability to "brute force" the exam.</p>
</li>
<li><p>We have security in place to validate exam submissions and prevent man-in-the-middle attacks or manipulation of the exam environment.</p>
</li>
<li><p>We manually review each passing exam for evidence of cheating. Our exam environment produces tons of metrics for us to draw from.</p>
</li>
</ol>
<p>We take cheating, and any form of academic dishonesty, seriously. We will act decisively.</p>
<p>This said, no one's exam results will be thrown out without human review, and no one's account will be banned without warning based on a single suspicious exam result.</p>
<h3 id="heading-are-these-exams-open-book-or-closed-book">Are these exams “open book” or “closed book”?</h3>
<p>All of freeCodeCamp’s exams are “closed book”, meaning you must rely only on your mind and not outside resources.</p>
<p>Of course, in the real world you’ll be able to look things up. And in the real world, we encourage you to do so.</p>
<p>But that is not what these exams are evaluating. These exams are instead designed to test your memory of details and your comprehension of concepts.</p>
<p>So when taking these exams, do not use outside assistance in the form of books, notes, AI tools, or other people. Use of any of these will be considered academic dishonesty.</p>
<h3 id="heading-do-you-record-my-webcam-microphone-or-require-me-to-upload-a-photo-of-my-personal-id">Do you record my webcam, microphone, or require me to upload a photo of my personal ID?</h3>
<p>No. We considered adding these as additional test-taking security measures. But we have less privacy-invading methods of detecting most forms of academic dishonesty.</p>
<h3 id="heading-if-the-environment-is-open-source-doesnt-that-make-it-less-secure">If the environment is open source, doesn't that make it less secure?</h3>
<p>"Given enough eyeballs, all bugs are shallow." – Linus’s Law, formulated by Eric S. Raymond in his book <em>The Cathedral and the Bazaar</em></p>
<p>Open source software projects are often more secure than their closed source equivalents. This is because a lot more people are scrutinizing the code. And a lot more people can potentially help identify bugs and other deficiencies, then fix them.</p>
<p>We feel confident that open source is the way to go for this exam environment system.</p>
<h3 id="heading-how-can-i-contribute-to-the-exam-environment-codebase">How can I contribute to the Exam Environment codebase?</h3>
<p>It's fully open source, and we'd welcome your code contributions. Please read our general <a target="_blank" href="https://contribute.freecodecamp.org/intro/">contributor onboarding documentation</a>.</p>
<p>Then check out the <a target="_blank" href="https://github.com/freeCodeCamp/exam-env">GitHub repo</a>.</p>
<p>You can help by creating issues to report bugs or request features.</p>
<p>You can also browse open <code>help wanted</code> issues and attempt to open pull requests addressing them.</p>
<h3 id="heading-are-the-exam-questions-themselves-open-source">Are the exam questions themselves open source?</h3>
<p>For obvious exam security reasons, the exam question banks themselves are not publicly accessible. :)</p>
<p>These are built and maintained by freeCodeCamp's staff instructional designers.</p>
<h3 id="heading-what-happens-if-i-have-internet-connectivity-issues-mid-exam">What happens if I have internet connectivity issues mid-exam?</h3>
<p>If you have internet connectivity issues mid exam, the next time you try submit an answer, you’ll be told there are connectivity issues. The system will keep prompting you to retry submitting until the connection succeeds.</p>
<h3 id="heading-what-if-my-computer-crashes-mid-exam">What if my computer crashes mid-exam?</h3>
<p>If your computer crashes mid exam, you’ll be able to re-open the Exam Environment. Then, if you still have time left for your exam attempt, you’ll be able to continue from where you left off.</p>
<h3 id="heading-can-i-take-exams-in-languages-other-than-english">Can I take exams in languages other than English?</h3>
<p>Not yet. We’re working to add multi-lingual support in the future.</p>
<h3 id="heading-i-have-completed-my-exam-why-cant-i-see-my-results-yet">I have completed my exam. Why can't I see my results yet?</h3>
<p>All exam attempts are reviewed by freeCodeCamp staff before we release the results. We do this to ensure the integrity of the exam process and to prevent cheating. Once your attempt has been reviewed, you'll be notified of your results the next time you log in to freeCodeCamp.org.</p>
<h3 id="heading-i-am-deaf-or-hard-of-hearing-can-i-still-take-the-exams">I am Deaf or hard of hearing. Can I still take the exams?</h3>
<p>Yes! While some exams may include audio components, we do make written transcripts available for reading.</p>
<h3 id="heading-i-am-blind-or-have-limited-vision-and-use-a-screen-reader-can-i-still-take-the-exams">I am blind or have limited vision, and use a screen reader. Can I still take the exams?</h3>
<p>We’re working on it. Our curriculum is fully screen reader accessible. We're still refining our screen reader usability for the Exam Environment app. This is a high priority for us.</p>
<h3 id="heading-i-use-a-keyboard-instead-of-a-mouse-can-i-navigate-the-exams-using-just-a-keyboard">I use a keyboard instead of a mouse. Can I navigate the exams using just a keyboard?</h3>
<p>This is a high priority for us. We hope to add keyboard navigation to the Exam Environment app soon.</p>
<h3 id="heading-are-exams-timed">Are exams timed?</h3>
<p>Yes, exams are timed. We err on the side of giving plenty of time to take the exam, to account for people who are non-native English speakers, or who have ADHD and other learning differences that can make timed exams more challenging.</p>
<p>If you have a condition that usually qualifies you for extra time on standardized exams, please email support@freecodecamp.org. We’ll review your request and see whether we can find a reasonable solution.</p>
<h3 id="heading-what-happens-if-i-fail-the-exam-can-i-retake-it">What happens if I fail the exam? Can I retake it?</h3>
<p>Yes. You get one exam attempt per week. After you attempt an exam, there is a one-week (exactly 168 hour) “cool-down” period where you cannot take any freeCodeCamp exams. This is to encourage you to study and to pace yourself.</p>
<p>There is no limit to the number of times you can take an exam. So if you fail, study more, practice your skills more, then try again the following week.</p>
<h3 id="heading-do-i-need-to-redo-the-projects-if-i-fail-the-exam">Do I need to redo the projects if I fail the exam?</h3>
<p>No. Once you’ve submitted a certification project, you do not need to ever submit it again.</p>
<p>You can re-do projects for practice, but we recommend that you instead build some of our many practice projects in freeCodeCamp’s developer interview job search section.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764629117812/35c0c09a-3131-4c01-8b97-d5c101912f9e.png" alt="A screenshot of the &quot;Prepare for the developer interview job search&quot; section with lots of coding projects" width="1562" height="958" loading="lazy"></p>
<h3 id="heading-what-happens-if-i-already-have-the-old-legacy-responsive-web-design-certification-should-i-claim-the-new-one">What happens if I already have the old Legacy Responsive Web Design certification? Should I claim the new one?</h3>
<p>The new certification has more theory and practice as well as an exam. So if you’re looking to brush up on your skills, then you can go through the new version of this certification.</p>
<h3 id="heading-what-will-happen-to-my-existing-coursework-progress-on-the-full-stack-certification-does-it-transfer-over-to-the-responsive-web-design-course">What will happen to my existing coursework progress on the Full Stack Certification? Does it transfer over to the Responsive Web Design course?</h3>
<p>If you’ve already started the <a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Certified Full Stack Developer Curriculum</a>, all of your previously completed work should already be saved there.</p>
<p>To be clear, we’ve copied over all of the coursework from the full stack certification to this newer certification.</p>
<h3 id="heading-can-i-still-continue-with-the-current-full-stack-developer-certification-and-just-not-do-the-new-certification">Can I still continue with the current Full Stack Developer Certification and just not do the new certification?</h3>
<p>We’ve moved the coursework for the <a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Full Stack Developer Certification</a> over and broken it up into smaller certifications. Currently there are seven courses available for you to go through. Here is the complete list:</p>
<ul>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/responsive-web-design-v9/">Responsive Web Design Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/javascript-v9/">JavaScript Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/front-end-development-libraries-v9/">Frontend Libraries Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/python-v9/">Python Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/relational-databases-v9/">Relational Databases Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/back-end-development-and-apis-v9/">Backend JavaScript Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Certified Full Stack Developer Certification</a></p>
</li>
</ul>
<p>The Certified Full Stack Developer Certification button will remain on the learn page for a short time to give people the opportunity to switch over to the new certifications. Over the next few months, though, this option will disappear.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763050732251/0276ffab-bd3f-46fe-bac0-a654ddfafcb5.png" alt="List of all certifications on the freeCodeCamp learn page." width="1834" height="1324" loading="lazy"></p>
<h3 id="heading-will-my-legacy-certifications-become-invalid">Will my legacy certifications become invalid?</h3>
<p>No. Once you claim a certification, it’s yours to keep.</p>
<p>Also note that we previously announced that freeCodeCamp certifications would have an expiration date and require recertification. We don’t plan to implement this anytime soon. And if we do decide to, we will give everyone at least a year’s notice.</p>
<h3 id="heading-will-the-exam-be-available-to-take-on-my-phone">Will the exam be available to take on my phone?</h3>
<p>At this time, no. You’ll need to use a laptop or desktop to download the exam environment and take the exam. We hope to eventually offer these certification exams on iPhone and Android.</p>
<h3 id="heading-i-have-a-disability-or-health-condition-that-is-not-covered-here-how-can-i-request-accommodations">I have a disability or health condition that is not covered here. How can I request accommodations?</h3>
<p>If you need specific accommodations for the exam (for example extra time, breaks, or alternative formats), please email support@freecodecamp.org. We’ll review your request and see whether we can find a reasonable solution.</p>
<h2 id="heading-anything-else">Anything else?</h2>
<p>Good luck working through freeCodeCamp’s coursework, building projects, and preparing for these exams.</p>
<p>Happy coding!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ freeCodeCamp's New JavaScript Certification is Now Live ]]>
                </title>
                <description>
                    <![CDATA[ The freeCodeCamp community just published our new JavaScript certification. You can now sit for the exam to earn the free verified certification, which you can add to your résumé, CV, or LinkedIn profile. Each certification is filled with hundreds of... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/freecodecamps-new-javascript-certification-is-now-live/</link>
                <guid isPermaLink="false">6936e6e9ba6866f4046b4f36</guid>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Certification ]]>
                    </category>
                
                    <category>
                        <![CDATA[ freeCodeCamp.org ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Mon, 08 Dec 2025 14:55:37 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1763760147447/32b0f575-098c-4898-945c-a2c696c699bb.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The freeCodeCamp community just published our new <a target="_blank" href="https://www.freecodecamp.org/learn/javascript-v9/">JavaScript certification</a>. You can now sit for the exam to earn the free verified certification, which you can add to your résumé, CV, or LinkedIn profile.</p>
<p>Each certification is filled with hundreds of hours worth of interactive lessons, workshops, labs, and quizzes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763671130712/e954f1f1-a6a6-45ed-9a6c-4acda48c07ed.png" alt="List of JavaScript modules in the new JavaScript certification" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-how-does-the-new-javascript-certification-work">How Does the New JavaScript Certification Work?</h2>
<p>The new <a target="_blank" href="https://www.freecodecamp.org/learn/javascript-v9/">JavaScript certification</a> will teach you core concepts including variables, functions, loops, objects, higher order functions, DOM manipulation, working with events, asynchronous JavaScript, and more.</p>
<p>The certification is broken down into several modules that include lessons, workshops, labs, review pages, and quizzes to ensure that you truly understand the material before moving onto the next module.</p>
<p>The lessons are your first exposure to new concepts. They provide crucial theory and context for how things work in the software development industry.</p>
<p>These lessons include our new interactive editor so you can see previews of the code. You can also play around with the examples for deeper understanding and comprehension.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763671301075/58dd093e-a35d-43c9-98d7-6c91e2854220.png" alt="Example of how to use the interactive editor in the JavaScript lessons." class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>At the end of each lesson, there will be three comprehension check questions to test your understanding of the material from the lesson.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763671455058/4a6c88f8-d6c1-48bb-8542-d7e249cb183c.png" alt="Example question from a JavaScript objects quiz." class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>After the lesson blocks, you will do the workshops. These workshops are guided step-based projects that provide you with an opportunity to practice what you have learned in the lessons.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763671562313/40e3d73e-999b-4a1d-b1e8-114d44394307.png" alt="Example step from the Build a muse player workshop." class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>After the workshops, you will complete a lab which will help you review what you have learned so far. This will give you chance to start building projects on your own, which is a crucial skill for a developer. You will be presented with a list of users stories and will need to pass the tests to complete the lab.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763671670300/668af0c9-b216-4ff4-b4a8-11d7ab84db14.png" alt="Example user stories for the Build a drum machine lab." class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>At the end of each module, there is a review page containing a list of all of the concepts covered. You can use these review pages to help you study for the quizzes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763671699590/4d50718e-7212-4c5b-b451-c21150fb7125.png" alt="Portions from the functional programming review page." class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>The last portion of the module is the quiz. This is a 20 question multiple choice quiz designed to test your understanding from the material covered in the module. You will need to get 18 out of 20 correct to pass.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763671876519/22f08eb9-f6dc-4420-a1b2-9898a28d8df4.png" alt="Example question on objects from the JavaScript objects quiz." class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>Throughout the certification, there will be five certification projects you will need to complete in order to qualify for the exam.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763671922540/96e0970a-9533-4f35-8237-64a964c52031.png" alt="List of certification projects in the new JavaScript certification" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>Once you’ve completed all 5 certification projects, you’ll be able to take the 50 question exam using our new open source exam environment. The freeCodeCamp community designed this exam environment tool with two goals: respecting your privacy while also making it harder for people to cheat.</p>
<p>Once you download the app to your laptop or desktop, you can take the exam.</p>
<h1 id="heading-frequently-asked-questions"><strong>Frequently Asked Questions</strong></h1>
<h2 id="heading-is-all-of-this-really-free"><strong>Is all of this really free?</strong></h2>
<p>Yes. freeCodeCamp has always been free, and we’ve now offered free verified certifications for more than a decade. These exams are just the latest expansion to our community’s free learning resources.</p>
<h2 id="heading-what-prevents-people-from-just-cheating-on-the-exams"><strong>What prevents people from just cheating on the exams?</strong></h2>
<p>Our goal is to strike a balance between preventing cheating and respecting people's right to privacy.</p>
<p>We've implemented a number of reliable, yet non-invasive, measures to help prevent people from cheating on freeCodeCamp's exams:</p>
<ol>
<li><p>For each exam, we have a massive bank of questions and potential answers to those questions. Each time a person attempts an exam, they'll see only a small, randomized sampling of these questions.</p>
</li>
<li><p>We only allow people to attempt an exam one time per week. This reduces their ability to "brute force" the exam.</p>
</li>
<li><p>We have security in place to validate exam submissions and prevent man-in-the-middle attacks or manipulation of the exam environment.</p>
</li>
<li><p>We manually review each passing exam for evidence of cheating. Our exam environment produces tons of metrics for us to draw from.</p>
</li>
</ol>
<p>We take cheating, and any form of academic dishonesty, seriously. We will act decisively.</p>
<p>This said, no one's exam results will be thrown out without human review, and no one's account will be banned without warning based on a single suspicious exam result.</p>
<h2 id="heading-are-these-exams-open-book-or-closed-book"><strong>Are these exams “open book” or “closed book”?</strong></h2>
<p>All of freeCodeCamp’s exams are “closed book”, meaning you must rely only on your mind and not outside resources.</p>
<p>Of course, in the real world you’ll be able to look things up. And in the real world, we encourage you to do so.</p>
<p>But that is not what these exams are evaluating. These exams are instead designed to test your memory of details and your comprehension of concepts.</p>
<p>So when taking these exams, do not use outside assistance in the form of books, notes, AI tools, or other people. Use of any of these will be considered academic dishonesty.</p>
<h2 id="heading-do-you-record-my-webcam-microphone-or-require-me-to-upload-a-photo-of-my-personal-id"><strong>Do you record my webcam, microphone, or require me to upload a photo of my personal ID?</strong></h2>
<p>No. We considered adding these as additional test-taking security measures. But we have less privacy-invading methods of detecting most forms of academic dishonesty.</p>
<h2 id="heading-if-the-environment-is-open-source-doesnt-that-make-it-less-secure"><strong>If the environment is open source, doesn't that make it less secure?</strong></h2>
<p>"Given enough eyeballs, all bugs are shallow." – Linus’s Law, formulated by Eric S. Raymond in his book <em>The Cathedral and the Bazaar</em></p>
<p>Open source software projects are often more secure than their closed source equivalents. This is because a lot more people are scrutinizing the code. And a lot more people can potentially help identify bugs and other deficiencies, then fix them.</p>
<p>We feel confident that open source is the way to go for this exam environment system.</p>
<h2 id="heading-how-can-i-contribute-to-the-exam-environment-codebase"><strong>How can I contribute to the Exam Environment codebase?</strong></h2>
<p>It's fully open source, and we'd welcome your code contributions. Please read our general <a target="_blank" href="https://contribute.freecodecamp.org/intro/">contributor onboarding documentation</a>.</p>
<p>Then check out the <a target="_blank" href="https://github.com/freeCodeCamp/exam-env">GitHub repo</a>.</p>
<p>You can help by creating issues to report bugs or request features.</p>
<p>You can also browse open <code>help wanted</code> issues and attempt to open pull requests addressing them.</p>
<h2 id="heading-are-the-exam-questions-themselves-open-source"><strong>Are the exam questions themselves open source?</strong></h2>
<p>For obvious exam security reasons, the exam question banks themselves are not publicly accessible. :)</p>
<p>These are built and maintained by freeCodeCamp's staff instructional designers.</p>
<h2 id="heading-what-happens-if-i-have-internet-connectivity-issues-mid-exam"><strong>What happens if I have internet connectivity issues mid-exam?</strong></h2>
<p>If you have internet connectivity issues mid exam, the next time you try submit an answer, you’ll be told there are connectivity issues. The system will keep prompting you to retry submitting until the connection succeeds.</p>
<h2 id="heading-what-if-my-computer-crashes-mid-exam"><strong>What if my computer crashes mid-exam?</strong></h2>
<p>If your computer crashes mid exam, you’ll be able to re-open the Exam Environment. Then, if you still have time left for your exam attempt, you’ll be able to continue from where you left off.</p>
<h2 id="heading-can-i-take-exams-in-languages-other-than-english"><strong>Can I take exams in languages other than English?</strong></h2>
<p>Not yet. We’re working to add multi-lingual support in the future.</p>
<h2 id="heading-i-have-completed-my-exam-why-cant-i-see-my-results-yet"><strong>I have completed my exam. Why can't I see my results yet?</strong></h2>
<p>All exam attempts are reviewed by freeCodeCamp staff before we release the results. We do this to ensure the integrity of the exam process and to prevent cheating. Once your attempt has been reviewed, you'll be notified of your results the next time you log in to freeCodeCamp.org.</p>
<h2 id="heading-i-am-deaf-or-hard-of-hearing-can-i-still-take-the-exams"><strong>I am Deaf or hard of hearing. Can I still take the exams?</strong></h2>
<p>Yes! While some exams may include audio components, we do make written transcripts available for reading.</p>
<h2 id="heading-i-am-blind-or-have-limited-vision-and-use-a-screen-reader-can-i-still-take-the-exams"><strong>I am blind or have limited vision, and use a screen reader. Can I still take the exams?</strong></h2>
<p>We’re working on it. Our curriculum is fully screen reader accessible. We're still refining our screen reader usability for the Exam Environment app. This is a high priority for us.</p>
<h2 id="heading-i-use-a-keyboard-instead-of-a-mouse-can-i-navigate-the-exams-using-just-a-keyboard"><strong>I use a keyboard instead of a mouse. Can I navigate the exams using just a keyboard?</strong></h2>
<p>This is a high priority for us. We hope to add keyboard navigation to the Exam Environment app soon.</p>
<h2 id="heading-are-exams-timed"><strong>Are exams timed?</strong></h2>
<p>Yes, exams are timed. We err on the side of giving plenty of time to take the exam, to account for people who are non-native English speakers, or who have ADHD and other learning differences that can make timed exams more challenging.</p>
<p>If you have a condition that usually qualifies you for extra time on standardized exams, please email support@freecodecamp.org. We’ll review your request and see whether we can find a reasonable solution.</p>
<h2 id="heading-what-happens-if-i-fail-the-exam-can-i-retake-it"><strong>What happens if I fail the exam? Can I retake it?</strong></h2>
<p>Yes. You get one exam attempt per week. After you attempt an exam, there is a one-week (exactly 168 hour) “cool-down” period where you cannot take any freeCodeCamp exams. This is to encourage you to study and to pace yourself.</p>
<p>There is no limit to the number of times you can take an exam. So if you fail, study more, practice your skills more, then try again the following week.</p>
<h2 id="heading-do-i-need-to-redo-the-projects-if-i-fail-the-exam"><strong>Do I need to redo the projects if I fail the exam?</strong></h2>
<p>No. Once you’ve submitted a certification project, you do not need to ever submit it again.</p>
<p>You can re-do projects for practice, but we recommend that you instead build some of our many practice projects in freeCodeCamp’s developer interview job search section.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764629117812/35c0c09a-3131-4c01-8b97-d5c101912f9e.png" alt="A screenshot of the &quot;Prepare for the developer interview job search&quot; section with lots of coding projects" width="600" height="400" loading="lazy"></p>
<h2 id="heading-what-happens-if-i-already-have-the-old-legacy-responsive-web-design-certification-should-i-claim-the-new-one"><strong>What happens if I already have the old Legacy Responsive Web Design certification? Should I claim the new one?</strong></h2>
<p>The new certification has more theory and practice as well as an exam. So if you’re looking to brush up on your skills, then you can go through the new version of this certification.</p>
<h2 id="heading-what-will-happen-to-my-existing-coursework-progress-on-the-full-stack-certification-does-it-transfer-over-to-the-responsive-web-design-course"><strong>What will happen to my existing coursework progress on the Full Stack Certification? Does it transfer over to the Responsive Web Design course?</strong></h2>
<p>If you’ve already started the <a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Certified Full Stack Developer Curriculum</a>, all of your previously completed work should already be saved there.</p>
<p>To be clear, we’ve copied over all of the coursework from the full stack certification to this newer certification.</p>
<h2 id="heading-can-i-still-continue-with-the-current-full-stack-developer-certification-and-just-not-do-the-new-certification"><strong>Can I still continue with the current Full Stack Developer Certification and just not do the new certification?</strong></h2>
<p>We’ve moved the coursework for the <a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Full Stack Developer Certification</a> over and broken it up into smaller certifications. Currently there are seven courses available for you to go through. Here is the complete list:</p>
<ul>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/responsive-web-design-v9/">Responsive Web Design Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/javascript-v9/">JavaScript Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/front-end-development-libraries-v9/">Frontend Libraries Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/python-v9/">Python Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/relational-databases-v9/">Relational Databases Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/back-end-development-and-apis-v9/">Backend JavaScript Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Certified Full Stack Developer Certification</a></p>
</li>
</ul>
<p>The Certified Full Stack Developer Certification button will remain on the learn page for a short time to give people the opportunity to switch over to the new certifications. Over the next few months, though, this option will disappear.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763050732251/0276ffab-bd3f-46fe-bac0-a654ddfafcb5.png" alt="List of all certifications on the freeCodeCamp learn page." width="600" height="400" loading="lazy"></p>
<h2 id="heading-will-my-legacy-certifications-become-invalid"><strong>Will my legacy certifications become invalid?</strong></h2>
<p>No. Once you claim a certification, it’s yours to keep.</p>
<p>Also note that we previously announced that freeCodeCamp certifications would have an expiration date and require recertification. We don’t plan to implement this anytime soon. And if we do decide to, we will give everyone at least a year’s notice.</p>
<h2 id="heading-will-the-exam-be-available-to-take-on-my-phone"><strong>Will the exam be available to take on my phone?</strong></h2>
<p>At this time, no. You’ll need to use a laptop or desktop to download the exam environment and take the exam. We hope to eventually offer these certification exams on iPhone and Android.</p>
<h2 id="heading-i-have-a-disability-or-health-condition-that-is-not-covered-here-how-can-i-request-accommodations"><strong>I have a disability or health condition that is not covered here. How can I request accommodations?</strong></h2>
<p>If you need specific accommodations for the exam (for example extra time, breaks, or alternative formats), please email support@freecodecamp.org. We’ll review your request and see whether we can find a reasonable solution.</p>
<h2 id="heading-anything-else"><strong>Anything else?</strong></h2>
<p>Good luck working through freeCodeCamp’s coursework, building projects, and preparing for these exams.</p>
<p>Happy coding!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ freeCodeCamp's New Responsive Web Design Certification is Now Live ]]>
                </title>
                <description>
                    <![CDATA[ The freeCodeCamp community just published our new Responsive Web Design certification. You can now sit for the exam to earn the free verified certification, which you can add to your résumé, CV, or LinkedIn profile. Each certification is filled with ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/freecodecamps-new-responsive-web-design-certification-is-now-live/</link>
                <guid isPermaLink="false">692f044a17ed56d5a1781fb1</guid>
                
                    <category>
                        <![CDATA[ freeCodeCamp.org ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Responsive Web Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Certification ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Tue, 02 Dec 2025 15:22:50 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1763760123080/749604bf-3620-40ad-bd5f-488bd8faa251.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The freeCodeCamp community just published our new <a target="_blank" href="https://www.freecodecamp.org/learn/responsive-web-design-v9/">Responsive Web Design certification</a>. You can now sit for the exam to earn the free verified certification, which you can add to your résumé, CV, or LinkedIn profile.</p>
<p>Each certification is filled with hundreds of hours worth of interactive lessons, workshops, labs, and quizzes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763400265601/61789182-1638-47a1-b0c4-3a6113bc657c.png" alt="List of HTML modules in the new Responsive Web Design certification" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-how-does-the-new-rwd-certification-work">How Does the New RWD Certification Work?</h2>
<p>The Responsive Web Design certification will teach you core concepts including semantic HTML, working with forms, the importance of accessibility, CSS Flexbox, responsive design, CSS Grid, and more.</p>
<p>The certification is broken down into several modules that include lessons, workshops, labs, review pages and quizzes to ensure that you truly understand the material before moving onto the next module.</p>
<p>The lessons are your first exposure to new concepts. They provide crucial theory and context for how things work in the software development industry.</p>
<p>These lessons include our new interactive editor so you can see previews of the code. You can also play around with the examples for deeper understanding and comprehension.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763400733720/9e5e1406-5b2d-448b-a69f-2f0330627516.png" alt="Example of using the interactive editor to explain how linear gradients works." class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>At the end of each lesson, there will be three comprehension check questions to test your understanding of the material from the lesson.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763400413902/e2ebeb1b-977d-4db1-a608-1bcce571d03b.png" alt="Example question from the working with forms quiz in the Responsive Web Design certification" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>After these lessons, you’ll head over to the workshops. These workshops are guided step-based projects that provide you with an opportunity to practice what you have learned in the lessons.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763400520984/630b4928-7023-4b0a-b86e-a69794f1d687.png" alt="Example step from the Build a City Skyline workshop" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>After the workshops, you’ll complete a lab which will help you review what you have learned so far. This will give you the chance to start building projects on your own, which is a crucial skill for a developer. You’ll be presented with a list of user stories and will need to pass the tests to complete the lab.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763401095507/5ac9ba2e-5efe-4de0-b71a-6d6f06eade71.png" alt="Example user stories from the Build a Product Landing Page lab" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>At the end of each module, there is a review page containing a list of all of the concepts covered. You can use these review pages to help you study for the quizzes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763401166897/a3d050d4-1e84-46c8-aa9e-9d5ef4f7eb46.png" alt="Portion of the review content from the CSS attribute selectors review page" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>The last portion of the module is the quiz. This is a 20 question multiple choice quiz designed to test your understanding from the material covered in the module. You’ll need to get 18 out of 20 correct to pass.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763401270586/0b6f5c74-bf29-4103-ade7-6c872ca3a043.png" alt="Example question from the CSS Grid Quiz" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>Throughout the certification, there will be five certification projects you’ll need to complete in order to qualify for the exam.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763401326863/5b35b3d3-7e15-427a-b37c-023b3b259648.png" alt="[Alt Text: List of HTML certification projects in the new Responsive Web Design certification]" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>Once you’ve completed all 5 certification projects, you’ll be able to take the 50 question exam using our new open source exam environment. The freeCodeCamp community designed this exam environment tool with two goals: respecting your privacy while also making it harder for people to cheat.</p>
<p>Once you download the app to your laptop or desktop, you can take the exam.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1762447991874/674b982c-0f3d-4e93-ab11-13bba384f52e.png" alt="Screenshot from the Responsive Web Design Certification Exam page" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h1 id="heading-frequently-asked-questions">Frequently Asked Questions</h1>
<h2 id="heading-is-all-of-this-really-free">Is all of this really free?</h2>
<p>Yes. freeCodeCamp has always been free, and we’ve now offered free verified certifications for more than a decade. These exams are just the latest expansion to our community’s free learning resources.</p>
<h2 id="heading-what-prevents-people-from-just-cheating-on-the-exams">What prevents people from just cheating on the exams?</h2>
<p>Our goal is to strike a balance between preventing cheating and respecting people's right to privacy.</p>
<p>We've implemented a number of reliable, yet non-invasive, measures to help prevent people from cheating on freeCodeCamp's exams:</p>
<ol>
<li><p>For each exam, we have a massive bank of questions and potential answers to those questions. Each time a person attempts an exam, they'll see only a small, randomized sampling of these questions.</p>
</li>
<li><p>We only allow people to attempt an exam one time per week. This reduces their ability to "brute force" the exam.</p>
</li>
<li><p>We have security in place to validate exam submissions and prevent man-in-the-middle attacks or manipulation of the exam environment.</p>
</li>
<li><p>We manually review each passing exam for evidence of cheating. Our exam environment produces tons of metrics for us to draw from.</p>
</li>
</ol>
<p>We take cheating, and any form of academic dishonesty, seriously. We will act decisively.</p>
<p>This said, no one's exam results will be thrown out without human review, and no one's account will be banned without warning based on a single suspicious exam result.</p>
<h2 id="heading-are-these-exams-open-book-or-closed-book">Are these exams “open book” or “closed book”?</h2>
<p>All of freeCodeCamp’s exams are “closed book”, meaning you must rely only on your mind and not outside resources.</p>
<p>Of course, in the real world you’ll be able to look things up. And in the real world, we encourage you to do so.</p>
<p>But that is not what these exams are evaluating. These exams are instead designed to test your memory of details and your comprehension of concepts.</p>
<p>So when taking these exams, do not use outside assistance in the form of books, notes, AI tools, or other people. Use of any of these will be considered academic dishonesty.</p>
<h2 id="heading-do-you-record-my-webcam-microphone-or-require-me-to-upload-a-photo-of-my-personal-id">Do you record my webcam, microphone, or require me to upload a photo of my personal ID?</h2>
<p>No. We considered adding these as additional test-taking security measures. But we have less privacy-invading methods of detecting most forms of academic dishonesty.</p>
<h2 id="heading-if-the-environment-is-open-source-doesnt-that-make-it-less-secure">If the environment is open source, doesn't that make it less secure?</h2>
<p>"Given enough eyeballs, all bugs are shallow." – Linus’s Law, formulated by Eric S. Raymond in his book <em>The Cathedral and the Bazaar</em></p>
<p>Open source software projects are often more secure than their closed source equivalents. This is because a lot more people are scrutinizing the code. And a lot more people can potentially help identify bugs and other deficiencies, then fix them.</p>
<p>We feel confident that open source is the way to go for this exam environment system.</p>
<h2 id="heading-how-can-i-contribute-to-the-exam-environment-codebase">How can I contribute to the Exam Environment codebase?</h2>
<p>It's fully open source, and we'd welcome your code contributions. Please read our general <a target="_blank" href="https://contribute.freecodecamp.org/intro/">contributor onboarding documentation</a>.</p>
<p>Then check out the <a target="_blank" href="https://github.com/freeCodeCamp/exam-env">GitHub repo</a>.</p>
<p>You can help by creating issues to report bugs or request features.</p>
<p>You can also browse open <code>help wanted</code> issues and attempt to open pull requests addressing them.</p>
<h2 id="heading-are-the-exam-questions-themselves-open-source">Are the exam questions themselves open source?</h2>
<p>For obvious exam security reasons, the exam question banks themselves are not publicly accessible. :)</p>
<p>These are built and maintained by freeCodeCamp's staff instructional designers.</p>
<h2 id="heading-what-happens-if-i-have-internet-connectivity-issues-mid-exam">What happens if I have internet connectivity issues mid-exam?</h2>
<p>If you have internet connectivity issues mid exam, the next time you try submit an answer, you’ll be told there are connectivity issues. The system will keep prompting you to retry submitting until the connection succeeds.</p>
<h2 id="heading-what-if-my-computer-crashes-mid-exam">What if my computer crashes mid-exam?</h2>
<p>If your computer crashes mid exam, you’ll be able to re-open the Exam Environment. Then, if you still have time left for your exam attempt, you’ll be able to continue from where you left off.</p>
<h2 id="heading-can-i-take-exams-in-languages-other-than-english">Can I take exams in languages other than English?</h2>
<p>Not yet. We’re working to add multi-lingual support in the future.</p>
<h2 id="heading-i-have-completed-my-exam-why-cant-i-see-my-results-yet">I have completed my exam. Why can't I see my results yet?</h2>
<p>All exam attempts are reviewed by freeCodeCamp staff before we release the results. We do this to ensure the integrity of the exam process and to prevent cheating. Once your attempt has been reviewed, you'll be notified of your results the next time you log in to freeCodeCamp.org.</p>
<h2 id="heading-i-am-deaf-or-hard-of-hearing-can-i-still-take-the-exams">I am Deaf or hard of hearing. Can I still take the exams?</h2>
<p>Yes! While some exams may include audio components, we do make written transcripts available for reading.</p>
<h2 id="heading-i-am-blind-or-have-limited-vision-and-use-a-screen-reader-can-i-still-take-the-exams">I am blind or have limited vision, and use a screen reader. Can I still take the exams?</h2>
<p>We’re working on it. Our curriculum is fully screen reader accessible. We're still refining our screen reader usability for the Exam Environment app. This is a high priority for us.</p>
<h2 id="heading-i-use-a-keyboard-instead-of-a-mouse-can-i-navigate-the-exams-using-just-a-keyboard">I use a keyboard instead of a mouse. Can I navigate the exams using just a keyboard?</h2>
<p>This is a high priority for us. We hope to add keyboard navigation to the Exam Environment app soon.</p>
<h2 id="heading-are-exams-timed">Are exams timed?</h2>
<p>Yes, exams are timed. We err on the side of giving plenty of time to take the exam, to account for people who are non-native English speakers, or who have ADHD and other learning differences that can make timed exams more challenging.</p>
<p>If you have a condition that usually qualifies you for extra time on standardized exams, please email support@freecodecamp.org. We’ll review your request and see whether we can find a reasonable solution.</p>
<h2 id="heading-what-happens-if-i-fail-the-exam-can-i-retake-it">What happens if I fail the exam? Can I retake it?</h2>
<p>Yes. You get one exam attempt per week. After you attempt an exam, there is a one-week (exactly 168 hour) “cool-down” period where you cannot take any freeCodeCamp exams. This is to encourage you to study and to pace yourself.</p>
<p>There is no limit to the number of times you can take an exam. So if you fail, study more, practice your skills more, then try again the following week.</p>
<h2 id="heading-do-i-need-to-redo-the-projects-if-i-fail-the-exam">Do I need to redo the projects if I fail the exam?</h2>
<p>No. Once you’ve submitted a certification project, you do not need to ever submit it again.</p>
<p>You can re-do projects for practice, but we recommend that you instead build some of our many practice projects in freeCodeCamp’s developer interview job search section.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764629117812/35c0c09a-3131-4c01-8b97-d5c101912f9e.png" alt="A screenshot of the &quot;Prepare for the developer interview job search&quot; section with lots of coding projects" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-what-happens-if-i-already-have-the-old-legacy-responsive-web-design-certification-should-i-claim-the-new-one">What happens if I already have the old Legacy Responsive Web Design certification? Should I claim the new one?</h2>
<p>The new certification has more theory and practice as well as an exam. So if you’re looking to brush up on your skills, then you can go through the new version of this certification.</p>
<h2 id="heading-what-will-happen-to-my-existing-coursework-progress-on-the-full-stack-certification-does-it-transfer-over-to-the-responsive-web-design-course">What will happen to my existing coursework progress on the Full Stack Certification? Does it transfer over to the Responsive Web Design course?</h2>
<p>If you’ve already started the <a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Certified Full Stack Developer Curriculum</a>, all of your previously completed work should already be saved there.</p>
<p>To be clear, we’ve copied over all of the coursework from the full stack certification to this newer certification.</p>
<h2 id="heading-can-i-still-continue-with-the-current-full-stack-developer-certification-and-just-not-do-the-new-certification">Can I still continue with the current Full Stack Developer Certification and just not do the new certification?</h2>
<p>We’ve moved the coursework for the <a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Full Stack Developer Certification</a> over and broken it up into smaller certifications. Currently there are seven courses available for you to go through. Here is the complete list:</p>
<ul>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/responsive-web-design-v9/">Responsive Web Design Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/javascript-v9/">JavaScript Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/front-end-development-libraries-v9/">Frontend Libraries Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/python-v9/">Python Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/relational-databases-v9/">Relational Databases Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/back-end-development-and-apis-v9/">Backend JavaScript Certification</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/learn/full-stack-developer-v9/">Certified Full Stack Developer Certification</a></p>
</li>
</ul>
<p>The Certified Full Stack Developer Certification button will remain on the learn page for a short time to give people the opportunity to switch over to the new certifications. Over the next few months, though, this option will disappear.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1763050732251/0276ffab-bd3f-46fe-bac0-a654ddfafcb5.png" alt="List of all certifications on the freeCodeCamp learn page." class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-will-my-legacy-certifications-become-invalid">Will my legacy certifications become invalid?</h2>
<p>No. Once you claim a certification, it’s yours to keep.</p>
<p>Also note that we previously announced that freeCodeCamp certifications would have an expiration date and require recertification. We don’t plan to implement this anytime soon. And if we do decide to, we will give everyone at least a year’s notice.</p>
<h2 id="heading-will-the-exam-be-available-to-take-on-my-phone">Will the exam be available to take on my phone?</h2>
<p>At this time, no. You’ll need to use a laptop or desktop to download the exam environment and take the exam. We hope to eventually offer these certification exams on iPhone and Android.</p>
<h2 id="heading-i-have-a-disability-or-health-condition-that-is-not-covered-here-how-can-i-request-accommodations"><strong>I have a disability or health condition that is not covered here. How can I request accommodations?</strong></h2>
<p>If you need specific accommodations for the exam (for example extra time, breaks, or alternative formats), please email support@freecodecamp.org. We’ll review your request and see whether we can find a reasonable solution.</p>
<h2 id="heading-anything-else">Anything else?</h2>
<p>Good luck working through freeCodeCamp’s coursework, building projects, and preparing for these exams.</p>
<p>Happy coding!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Add and Remove Elements from Arrays in JavaScript ]]>
                </title>
                <description>
                    <![CDATA[ Arrays are common data structures in JavaScript, and it is important to know how to work with them. Common operations on arrays include adding or removing elements from the beginning, end or at a specific index. In this article, you will learn how to... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-add-and-remove-js-array-elements/</link>
                <guid isPermaLink="false">66b8d9628cd1c2aa053d49b2</guid>
                
                    <category>
                        <![CDATA[ arrays ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Wed, 13 Mar 2024 12:34:33 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/03/mohammad-rahmani-unwXUc_Pqi4-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Arrays are common data structures in JavaScript, and it is important to know how to work with them. Common operations on arrays include adding or removing elements from the beginning, end or at a specific index.</p>
<p>In this article, you will learn how to work with the built in JavaScript methods: <code>pop</code>, <code>push</code>, <code>shift</code> and <code>unshift</code>. You will also learn how to work with the <code>splice</code> method which allows you to mutate the original array and add/remove elements at a specific index.</p>
<h2 id="heading-what-is-an-array-in-javascript">What is an Array in JavaScript?</h2>
<p>Before we start looking at these different array methods, it is important to understand what an array is in JavaScript.</p>
<p>An array is a type of data structure in JavaScript that is used to store a collection of elements that can be of different types. These data types can include strings, numbers, booleans(<code>true</code> or <code>false</code>), other arrays and objects(<code>{}</code>).</p>
<p>Here is an example of an array of names:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> names = [<span class="hljs-string">"Jessica"</span>, <span class="hljs-string">"Jacob"</span>, <span class="hljs-string">"Zach"</span>, <span class="hljs-string">"Michelle"</span>];
</code></pre>
<p>To access an element from an array, you reference the array name, followed by a pair of square brackets containing the index of the element you want to access.</p>
<p>Arrays are zero-indexed, which means the first element in the array has an index of 0, the second element has an index of 1, and so on.</p>
<p>Here is an example of accessing the second element in the <code>names</code> array:</p>
<pre><code class="lang-js">names[<span class="hljs-number">1</span>]; <span class="hljs-comment">// "Jacob"</span>
</code></pre>
<p>If you want to access the last element in an array, you can use the length of the array minus 1.</p>
<pre><code class="lang-js">names[names.length - <span class="hljs-number">1</span>]; <span class="hljs-comment">// "Michelle"</span>
</code></pre>
<h2 id="heading-how-to-remove-an-element-at-the-end-of-the-array">How to Remove an Element at the End of the Array</h2>
<p>If you want to remove an element at the end of an array, you can use the <code>pop</code> method. The <code>pop</code> method removes the last element from an array and returns that element.</p>
<p>Here is an example of using the <code>pop</code> method on the <code>names</code> array:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> names = [<span class="hljs-string">"Jessica"</span>, <span class="hljs-string">"Jacob"</span>, <span class="hljs-string">"Zach"</span>, <span class="hljs-string">"Michelle"</span>];
<span class="hljs-keyword">const</span> removedName = names.pop();

<span class="hljs-built_in">console</span>.log(removedName); <span class="hljs-comment">// "Michelle"</span>
</code></pre>
<p>If you try to use the <code>pop</code> method on an empty array, it will return <code>undefined</code>.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> emptyArray = [];
<span class="hljs-keyword">const</span> removedElement = emptyArray.pop();

<span class="hljs-built_in">console</span>.log(removedElement); <span class="hljs-comment">// undefined</span>
</code></pre>
<p>If you log out the <code>names</code> array, then you will see the remaining elements.</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(names); <span class="hljs-comment">// ["Jessica", "Jacob", "Zach"]</span>
</code></pre>
<h2 id="heading-how-to-remove-an-element-at-the-beginning-of-the-array">How to Remove an Element at the Beginning of the Array</h2>
<p>If you want to remove an element at the beginning of an array, you can use the <code>shift</code> method. The <code>shift</code> method removes the first element from an array and returns that element.</p>
<p>Here is an example of using the <code>shift</code> method on the <code>names</code> array:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> names = [<span class="hljs-string">"Jessica"</span>, <span class="hljs-string">"Jacob"</span>, <span class="hljs-string">"Zach"</span>, <span class="hljs-string">"Michelle"</span>];
<span class="hljs-keyword">const</span> removedName = names.shift();

<span class="hljs-built_in">console</span>.log(removedName); <span class="hljs-comment">// "Jessica"</span>
</code></pre>
<p>Just like the <code>pop</code> method, if you try to use the <code>shift</code> method on an empty array, it will return <code>undefined</code>.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> emptyArray = [];
<span class="hljs-keyword">const</span> removedElement = emptyArray.shift();

<span class="hljs-built_in">console</span>.log(removedElement); <span class="hljs-comment">// undefined</span>
</code></pre>
<h2 id="heading-how-to-add-an-element-at-the-end-of-the-array">How to Add an Element at the End of the Array</h2>
<p>If you need to add an element to the end of an array, you can use the <code>push</code> method. The <code>push</code> method adds one or more elements to the end of an array and returns the new length of the array.</p>
<p>Here is an example of an array of programming languages:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> programmingLanguages = [<span class="hljs-string">"JavaScript"</span>, <span class="hljs-string">"Python"</span>, <span class="hljs-string">"Ruby"</span>];
</code></pre>
<p>If you want to add the languages of <code>Go</code> and <code>Rust</code> to the end of the <code>programmingLanguages</code> array, you would use the <code>push</code> method.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> programmingLanguages = [<span class="hljs-string">"JavaScript"</span>, <span class="hljs-string">"Python"</span>, <span class="hljs-string">"Ruby"</span>];
<span class="hljs-keyword">const</span> originalLength = programmingLanguages.length; <span class="hljs-comment">// 3</span>

<span class="hljs-keyword">const</span> newLength = programmingLanguages.push(<span class="hljs-string">"Go"</span>, <span class="hljs-string">"Rust"</span>);

<span class="hljs-built_in">console</span>.log(newLength); <span class="hljs-comment">// 5</span>
<span class="hljs-built_in">console</span>.log(programmingLanguages); <span class="hljs-comment">// ["JavaScript", "Python", "Ruby", "Go", "Rust"]</span>
</code></pre>
<p>A cool thing you can do with the <code>push</code> method is to add an array to the end of another array.</p>
<p>In this example we have an array of <code>programmingLanguages</code> and an array of <code>newLanguages</code>. We can use the <code>push</code> method and <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax">spread syntax</a> to add the <code>newLanguages</code> array to the end of the <code>programmingLanguages</code> array.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> programmingLanguages = [<span class="hljs-string">"JavaScript"</span>, <span class="hljs-string">"Python"</span>, <span class="hljs-string">"Ruby"</span>];
<span class="hljs-keyword">const</span> newLanguages = [<span class="hljs-string">"Go"</span>, <span class="hljs-string">"Rust"</span>];

<span class="hljs-keyword">const</span> newLength = programmingLanguages.push(...newLanguages);

<span class="hljs-built_in">console</span>.log(newLength); <span class="hljs-comment">// 5</span>
<span class="hljs-built_in">console</span>.log(programmingLanguages); <span class="hljs-comment">// ["JavaScript", "Python", "Ruby", "Go", "Rust"]</span>
</code></pre>
<h2 id="heading-how-to-add-an-element-at-the-beginning-of-the-array">How to Add an Element at the Beginning of the Array</h2>
<p>If you want to add an element to the beginning of an array, you can use the <code>unshift</code> method. The <code>unshift</code> method adds one or more elements to the beginning of an array and returns the new length of the array.</p>
<p>Here is an example of using the <code>unshift</code> method to add three new programming languages to the beginning of the <code>programmingLanguages</code> array.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> programmingLanguages = [<span class="hljs-string">"JavaScript"</span>, <span class="hljs-string">"Python"</span>, <span class="hljs-string">"Ruby"</span>];
<span class="hljs-keyword">const</span> originalLength = programmingLanguages.length; <span class="hljs-comment">// 3</span>

<span class="hljs-keyword">const</span> newLength = programmingLanguages.unshift(<span class="hljs-string">"Go"</span>, <span class="hljs-string">"Rust"</span>, <span class="hljs-string">"C#"</span>);

<span class="hljs-built_in">console</span>.log(newLength); <span class="hljs-comment">// 6</span>
<span class="hljs-built_in">console</span>.log(programmingLanguages); <span class="hljs-comment">// ["Go", "Rust", "C#", "JavaScript", "Python", "Ruby"]</span>
</code></pre>
<h2 id="heading-how-to-add-and-remove-elements-at-a-specific-index">How to Add and Remove Elements at a Specific Index</h2>
<p>An index is the position of an element in the array. The first element in the array has an index of 0, the second element has an index of 1, and so on.</p>
<p>To add elements at a specific index, you can use the <code>splice</code> method. The <code>splice</code> method allows you to add and remove elements from a specific index in an array.</p>
<p>In this example, we have a list of American cities.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> cities = [<span class="hljs-string">"New York"</span>, <span class="hljs-string">"Los Angeles"</span>, <span class="hljs-string">"Chicago"</span>, <span class="hljs-string">"Houston"</span>];
</code></pre>
<p>If we want to add the city of <code>San Francisco</code> to the second index of the <code>cities</code> array, we would use the <code>splice</code> method.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> cities = [<span class="hljs-string">"New York"</span>, <span class="hljs-string">"Los Angeles"</span>, <span class="hljs-string">"Chicago"</span>, <span class="hljs-string">"Houston"</span>];

cities.splice(<span class="hljs-number">1</span>, <span class="hljs-number">0</span>, <span class="hljs-string">"San Francisco"</span>);

<span class="hljs-built_in">console</span>.log(cities); <span class="hljs-comment">// ["New York", "San Francisco", "Los Angeles", "Chicago", "Houston"]</span>
</code></pre>
<p>The first argument of the <code>splice</code> method is the index where you want to add or remove elements. In this case, we want to add our city at index 1.</p>
<p>The second argument is the number of elements to remove. In this case, we are not looking to remove any elements, so we pass in 0.</p>
<p>The third argument is the element(s) you want to add. This is where we pass in the city of <code>San Francisco</code>.</p>
<pre><code class="lang-js">cities.splice(<span class="hljs-number">1</span>, <span class="hljs-number">0</span>, <span class="hljs-string">"San Francisco"</span>);
</code></pre>
<p>If we want to remove elements at a specific index, we can use the <code>splice</code> method as well.</p>
<p>In this example, we want to remove the city of <code>Los Angeles</code> from the <code>cities</code> array. We can use the <code>indexOf</code> method to find the index of <code>Los Angeles</code> and then use the <code>splice</code> method to remove it.</p>
<p>The <code>indexOf</code> method returns the first index at which a given element can be found in the array, or -1 if it is not present.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> cities = [<span class="hljs-string">"New York"</span>, <span class="hljs-string">"Los Angeles"</span>, <span class="hljs-string">"Chicago"</span>, <span class="hljs-string">"Houston"</span>];

<span class="hljs-keyword">const</span> index = cities.indexOf(<span class="hljs-string">"Los Angeles"</span>);

<span class="hljs-keyword">if</span> (index !== <span class="hljs-number">-1</span>) {
  cities.splice(index, <span class="hljs-number">1</span>);
}

<span class="hljs-built_in">console</span>.log(cities); <span class="hljs-comment">// ["New York", "Chicago", "Houston"]</span>
</code></pre>
<p>The first argument of <code>index</code> is the index where we want to remove the element. The second argument of 1 is the number of elements we want to remove.</p>
<pre><code class="lang-js">cities.splice(index, <span class="hljs-number">1</span>);
</code></pre>
<p>We are wrapping this inside an <code>if</code> statement to check if the index of <code>Los Angeles</code> is not equal to -1. -1 represents that the element is not present in the array.</p>
<p>If the city is present in the array, then we can use the <code>splice</code> method to remove it.</p>
<pre><code class="lang-js"><span class="hljs-keyword">if</span> (index !== <span class="hljs-number">-1</span>) {
  cities.splice(index, <span class="hljs-number">1</span>);
}
</code></pre>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this article you learned how to work with the built in JavaScript methods of <code>pop</code>, <code>push</code>, <code>shift</code> and <code>unshift</code>. These methods are useful when you want to add or remove elements from the beginning or end of an array.</p>
<p>You also learned how to work with the <code>splice</code> method which allows you to mutate the original array and add/remove elements at a specific index.</p>
<p>All of the methods we covered in this article mutate the original array. This means that the original array is changed after using these methods.</p>
<p>I hope you found this article helpful and happy coding!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Access Properties from an Array of Objects in JavaScript ]]>
                </title>
                <description>
                    <![CDATA[ When you're working with JavaScript applications, it's common to work with arrays, nested arrays, and an array of objects. But a lot of beginners sometimes struggle with knowing how to access properties from these different data structures. In this a... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-access-properties-from-an-array-of-objects-in-javascript/</link>
                <guid isPermaLink="false">66b8d95df805ffd579552e88</guid>
                
                    <category>
                        <![CDATA[ arrays ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Thu, 29 Feb 2024 00:59:30 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/02/david-rangel-4m7gmLNr3M0-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>When you're working with JavaScript applications, it's common to work with arrays, nested arrays, and an array of objects. But a lot of beginners sometimes struggle with knowing how to access properties from these different data structures.</p>
<p>In this article, we will discuss how to access properties from a variety of arrays and look at a few code examples.</p>
<h2 id="heading-what-is-an-array-in-javascript">What is an Array in JavaScript?</h2>
<p>An array is a type of data structure in JavaScript that is used to store a collection of elements that can be of different types.</p>
<p>You can have an array of strings, like this:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> fruits = [<span class="hljs-string">"apple"</span>, <span class="hljs-string">"banana"</span>, <span class="hljs-string">"mango"</span>, <span class="hljs-string">"orange"</span>];
</code></pre>
<p>You can have an array of numbers:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> numbers = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>];
</code></pre>
<p>You can have a nested array of arrays like this:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> nestedArray = [
  [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>],
  [<span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>],
  [<span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>],
];
</code></pre>
<p>You can also have an array of mixed data types:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> mixedArray = [<span class="hljs-string">"apple"</span>, <span class="hljs-number">1</span>, <span class="hljs-string">"banana"</span>, <span class="hljs-number">2</span>, <span class="hljs-string">"mango"</span>, <span class="hljs-number">3</span>];
</code></pre>
<h2 id="heading-how-to-access-elements-from-an-array-in-javascript">How to Access Elements from an Array in JavaScript</h2>
<p>To access an element from an array, you reference the array name, followed by a pair of square brackets containing the index of the element you want to access.</p>
<p>Here is an example of accessing the first element from the <code>fruits</code> array:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> fruits = [<span class="hljs-string">"apple"</span>, <span class="hljs-string">"banana"</span>, <span class="hljs-string">"mango"</span>, <span class="hljs-string">"orange"</span>];
<span class="hljs-built_in">console</span>.log(fruits[<span class="hljs-number">0</span>]); <span class="hljs-comment">// apple</span>
</code></pre>
<p>Arrays are zero-indexed, which means the first element in the array has an index of 0, the second element has an index of 1, and so on.</p>
<p>If you want to access the last element in an array, you can use the length of the array minus 1.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> fruits = [<span class="hljs-string">"apple"</span>, <span class="hljs-string">"banana"</span>, <span class="hljs-string">"mango"</span>, <span class="hljs-string">"orange"</span>];
<span class="hljs-built_in">console</span>.log(fruits[fruits.length - <span class="hljs-number">1</span>]); <span class="hljs-comment">// orange</span>
</code></pre>
<p>Sometimes it can get confusing when you are dealing with a nested array of arrays. But the syntax remains the same when you want to access an element from a nested array.</p>
<p>Here is an example of accessing the first element from the first array in the <code>nestedArray</code>:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> nestedNumberArray = [
  [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>],
  [<span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>],
  [<span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>],
];
<span class="hljs-built_in">console</span>.log(nestedNumberArray[<span class="hljs-number">0</span>][<span class="hljs-number">0</span>]); <span class="hljs-comment">// 1</span>
</code></pre>
<p><code>nestedNumberArray[0]</code> points to this array here:</p>
<pre><code class="lang-js">[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>];
</code></pre>
<p>To access the first element from this array, you use another pair of square brackets with the index of the element you want to access.</p>
<pre><code class="lang-js">nestedNumberArray[<span class="hljs-number">0</span>][<span class="hljs-number">0</span>];
</code></pre>
<h2 id="heading-how-to-access-properties-from-an-array-of-objects-in-javascript">How to Access Properties from an Array of Objects in JavaScript</h2>
<p>Often times you will encounter an array of objects in JavaScript.</p>
<p>Here is an example with an array of developers. Each developer has a name, age, and an array of programming languages they know.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> developers = [
  { <span class="hljs-attr">name</span>: <span class="hljs-string">"John"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">25</span>, <span class="hljs-attr">languages</span>: [<span class="hljs-string">"JavaScript"</span>, <span class="hljs-string">"Python"</span>] },
  { <span class="hljs-attr">name</span>: <span class="hljs-string">"Kelly"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">37</span>, <span class="hljs-attr">languages</span>: [<span class="hljs-string">"Ruby"</span>, <span class="hljs-string">"Python"</span>, <span class="hljs-string">"C"</span>, <span class="hljs-string">"C++"</span>] },
  { <span class="hljs-attr">name</span>: <span class="hljs-string">"Zack"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">45</span>, <span class="hljs-attr">languages</span>: [<span class="hljs-string">"Go"</span>, <span class="hljs-string">"C#"</span>] },
];
</code></pre>
<p>If you wanted to access the name of the first developer, you can use the following syntax:</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(developers[<span class="hljs-number">0</span>].name); <span class="hljs-comment">// John</span>
</code></pre>
<p>Here we are using a combination of dot and bracket notation to access the name property of the first developer object in the <code>developers</code> array.</p>
<p><code>developers[0]</code> is the first developer object</p>
<pre><code class="lang-js">{ <span class="hljs-attr">name</span>: <span class="hljs-string">"John"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">25</span>, <span class="hljs-attr">languages</span>: [<span class="hljs-string">"JavaScript"</span>, <span class="hljs-string">"Python"</span>] }
</code></pre>
<p>Then we use dot notation (<code>developers[0].name</code>) to access the <code>name</code> property of this object.</p>
<h2 id="heading-how-to-find-a-specific-value-from-an-array-of-objects-in-javascript">How to Find a Specific Value from an Array of Objects in JavaScript</h2>
<p>If we are looking for a specific object from an array of objects, we can use the <code>find</code> method. The <code>find</code> method returns the first element in the array that satisfies the provided testing function. If no elements pass the test, <code>undefined</code> is returned.</p>
<p>Here is an example of using the <code>find</code> method for an array of numbers:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> numbers = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>];

<span class="hljs-keyword">const</span> foundNumber = numbers.find(<span class="hljs-function">(<span class="hljs-params">number</span>) =&gt;</span> number &gt; <span class="hljs-number">3</span>); <span class="hljs-comment">// 4</span>
</code></pre>
<p>The following example looks through the numbers array and returns the first number that is greater than 3. In this case, the <code>find</code> method returns the number 4.</p>
<p>We can apply the same concept to find a specific object from an array of objects.</p>
<p>In the following example, we are looking for the developer object with the name "Kelly".</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> developers = [
  { <span class="hljs-attr">name</span>: <span class="hljs-string">"John"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">25</span>, <span class="hljs-attr">languages</span>: [<span class="hljs-string">"JavaScript"</span>, <span class="hljs-string">"Python"</span>] },
  { <span class="hljs-attr">name</span>: <span class="hljs-string">"Kelly"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">37</span>, <span class="hljs-attr">languages</span>: [<span class="hljs-string">"Ruby"</span>, <span class="hljs-string">"Python"</span>, <span class="hljs-string">"C"</span>, <span class="hljs-string">"C++"</span>] },
  { <span class="hljs-attr">name</span>: <span class="hljs-string">"Zack"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">45</span>, <span class="hljs-attr">languages</span>: [<span class="hljs-string">"Go"</span>, <span class="hljs-string">"C#"</span>] },
];

developers.find(<span class="hljs-function">(<span class="hljs-params">developer</span>) =&gt;</span> developer.name === <span class="hljs-string">"Kelly"</span>);
</code></pre>
<p>In this example, <code>developer</code> represents each object in the array. The <code>find</code> method will go through the <code>developers</code> array and return the first developer object that has the name "Kelly".</p>
<pre><code class="lang-js">{ <span class="hljs-attr">name</span>: <span class="hljs-string">"Kelly"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">37</span>, <span class="hljs-attr">languages</span>: [<span class="hljs-string">"Ruby"</span>, <span class="hljs-string">"Python"</span>, <span class="hljs-string">"C"</span>, <span class="hljs-string">"C++"</span>] }
</code></pre>
<h2 id="heading-conclusion">Conclusion</h2>
<p>I hope you found this article helpful when learning about arrays and how to access properties from them.</p>
<p>We looked at a few examples of arrays as well as how to access elements from nested arrays and an array of objects.</p>
<p>We also learned about the <code>find</code> method and how to use it to find a specific object from an array of objects.</p>
<p>Now you should have a better understanding of how to work with arrays and objects in JavaScript.</p>
<p>Happy coding! 🚀</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Use the Greater Than and Less Than Operators in JavaScript ]]>
                </title>
                <description>
                    <![CDATA[ In your JavaScript programs, you'll often need to compare two values to see if one is greater than or less than the other. This is where the greater than and less than operators come in handy. In this article, we'll look at how to use these operators... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/greater-than-and-less-than-operators-in-js/</link>
                <guid isPermaLink="false">66b8d9538cd1c2aa053d49b0</guid>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Operators ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Tue, 13 Feb 2024 11:02:26 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/02/pexels-pixabay-417173--3-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In your JavaScript programs, you'll often need to compare two values to see if one is greater than or less than the other. This is where the greater than and less than operators come in handy.</p>
<p>In this article, we'll look at how to use these operators in greater detail through code examples.</p>
<h2 id="heading-how-to-use-the-greater-than-gt-operator-in-javascript">How to Use the Greater Than <code>&gt;</code> Operator in JavaScript</h2>
<p>You can use the greater than operator to check if the value on the left is greater than the value on the right. It is represented by the <code>&gt;</code> symbol.</p>
<p>The result will return a Boolean value of <code>true</code> if the value on the left is greater than the value on the right, and <code>false</code> if it is not.</p>
<p>Here is an example of checking if <code>5</code> is greater than <code>3</code>:</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-number">5</span> &gt; <span class="hljs-number">3</span>); <span class="hljs-comment">// true</span>
</code></pre>
<p>Since the number <code>5</code> is greater than <code>3</code>, the result will be <code>true</code>.</p>
<p>If we switch the two values, then the result will be <code>false</code>:</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-number">3</span> &gt; <span class="hljs-number">5</span>); <span class="hljs-comment">// false</span>
</code></pre>
<h2 id="heading-how-to-use-the-less-than-lt-operator-in-javascript">How to Use the Less Than <code>&lt;</code> Operator in JavaScript</h2>
<p>You can use the less than operator to check if the value on the left is less than the value on the right. It is represented by the <code>&lt;</code> symbol.</p>
<p>The result will return a Boolean value of <code>true</code> if the value on the left is less than the value on the right, and <code>false</code> if it is not.</p>
<p>Here is an example that checks if the number <code>3</code> is less than <code>5</code>:</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-number">3</span> &lt; <span class="hljs-number">5</span>); <span class="hljs-comment">// true</span>
</code></pre>
<p>Since <code>3</code> is less than <code>5</code>, the result will be <code>true</code>.</p>
<p>But if we switch the two values, then the result will be <code>false</code>:</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-number">5</span> &lt; <span class="hljs-number">3</span>); <span class="hljs-comment">// false</span>
</code></pre>
<h2 id="heading-how-to-use-the-greater-than-or-equal-to-gt-operator-in-javascript">How to Use the Greater Than or Equal To <code>&gt;=</code> Operator in JavaScript</h2>
<p>If you need to check if the value on the left is greater than or equal to the value on the right, you can use the greater than or equal to operator. It is represented by the <code>&gt;=</code> symbol.</p>
<p>The result will return a Boolean value of <code>true</code> if the value on the left is greater than or equal to the value on the right, and <code>false</code> if it is not.</p>
<p>Here is an example of that checks if the number <code>5</code> is greater than or equal to <code>5</code>:</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-number">5</span> &gt;= <span class="hljs-number">5</span>); <span class="hljs-comment">// true</span>
</code></pre>
<p>Since the number <code>5</code> is equal to <code>5</code>, the result will be <code>true</code>.</p>
<p>If we change the left value to be the number <code>3</code>, then the result will be <code>false</code>:</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-number">3</span> &gt;= <span class="hljs-number">5</span>); <span class="hljs-comment">// false</span>
</code></pre>
<h2 id="heading-how-to-use-the-less-than-or-equal-to-lt-operator-in-javascript">How to Use the Less Than or Equal To <code>&lt;=</code> Operator in JavaScript</h2>
<p>If you need to check if the value on the left is less than or equal to the value on the right, you can use the less than or equal to operator. It is represented by the <code>&lt;=</code> symbol.</p>
<p>The result will return a Boolean value of <code>true</code> if the value on the left is less than or equal to the value on the right, and <code>false</code> if it is not.</p>
<p>Here is an example of that checks if the number <code>3</code> is less than or equal to <code>5</code>:</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-number">3</span> &lt;= <span class="hljs-number">5</span>); <span class="hljs-comment">// true</span>
</code></pre>
<p>If we change the left value to be the number <code>6</code>, then the result will be <code>false</code>:</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(<span class="hljs-number">6</span> &lt;= <span class="hljs-number">5</span>); <span class="hljs-comment">// false</span>
</code></pre>
<h2 id="heading-how-to-use-comparison-operators-in-a-conditional-statement">How to Use Comparison Operators in a Conditional Statement</h2>
<p>It is common to use comparison operators inside conditional statements like an <code>if</code> statement.</p>
<p>In this example, we have an application that asks the user for their age and displays a response based on the age they entered:</p>
<p>For the HTML, we'll use a form to ask the user for their age. Below the form, we'll display the message based on the age entered.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"title"</span>&gt;</span>How old are you?<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">main</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"form"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"input-container"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">label</span> <span class="hljs-attr">for</span>=<span class="hljs-string">"age"</span>&gt;</span>Enter your age: <span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"number"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"age"</span> <span class="hljs-attr">required</span> <span class="hljs-attr">min</span>=<span class="hljs-string">"1"</span> <span class="hljs-attr">max</span>=<span class="hljs-string">"120"</span> /&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>

    <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"submit-btn"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"submit-btn"</span>&gt;</span>Submit age<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>

  <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"result-para"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"result"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">main</span>&gt;</span>
</code></pre>
<p>Next, we'll use a method called <code>getElementById</code> to go through the HTML document to find the elements that match the ids we specify. </p>
<p>We can use the method to get the form element, age input and result paragraph, and assign them to <code>const</code> variables:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> ageInput = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"age"</span>);
<span class="hljs-keyword">const</span> form = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"form"</span>);
<span class="hljs-keyword">const</span> resultParagraph = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"result"</span>);
</code></pre>
<p>We then want to create an array of strings to show the user based on their age.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> responsesArr = [
  <span class="hljs-string">"Oh wow! You are just a kid."</span>,
  <span class="hljs-string">"Nice! It looks like you are old enough to drive in the States."</span>,
  <span class="hljs-string">"Awesome! It looks like you are old enough to vote in the States."</span>,
  <span class="hljs-string">"Cool! It looks like you are old enough to drink in the States."</span>,
];
</code></pre>
<p>Then we need to create a function called <code>displayResponse</code> with a parameter called <code>age</code>. This function will be responsible for displaying the messages based on the age entered.</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">displayResponse</span>(<span class="hljs-params">age</span>) </span>{

}
</code></pre>
<p>Inside that function, we need to check if the user's age is less than <code>16</code>. If it is, we'll display the first message in the <code>responsesArr</code> array.</p>
<p>We'll use the <code>textContent</code> property to change the text inside the <code>resultParagraph</code> element.</p>
<pre><code class="lang-js"><span class="hljs-keyword">if</span> (age &lt; <span class="hljs-number">16</span>) {
  resultParagraph.textContent = responsesArr[<span class="hljs-number">0</span>];
}
</code></pre>
<p>If the user is between <code>16</code> and <code>18</code>, we will display the second message in the <code>responsesArr</code> array.</p>
<pre><code class="lang-js"><span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (age &gt;= <span class="hljs-number">16</span> &amp;&amp; age &lt; <span class="hljs-number">18</span>) {
    resultParagraph.textContent = responsesArr[<span class="hljs-number">1</span>];
  }
</code></pre>
<p>If the user is between <code>18</code> and <code>21</code>, we will display the third message in the <code>responsesArr</code> array.</p>
<pre><code class="lang-js"><span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (age &gt;= <span class="hljs-number">18</span> &amp;&amp; age &lt; <span class="hljs-number">21</span>) {
    resultParagraph.textContent = responsesArr[<span class="hljs-number">2</span>];
}
</code></pre>
<p>If the user is <code>21</code> or older, we will display the last message in the <code>responsesArr</code> array.</p>
<pre><code class="lang-js"><span class="hljs-keyword">else</span> {
    resultParagraph.textContent = responsesArr[<span class="hljs-number">3</span>];
  }
</code></pre>
<p>The last part of this function is to reset the form after the user submits their age.</p>
<pre><code class="lang-js">ageInput.value = <span class="hljs-string">""</span>;
</code></pre>
<p>Here is the complete function:</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">displayResponse</span>(<span class="hljs-params">age</span>) </span>{
  <span class="hljs-keyword">if</span> (age &lt; <span class="hljs-number">16</span>) {
    resultParagraph.textContent = responsesArr[<span class="hljs-number">0</span>];
  } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (age &gt;= <span class="hljs-number">16</span> &amp;&amp; age &lt; <span class="hljs-number">18</span>) {
    resultParagraph.textContent = responsesArr[<span class="hljs-number">1</span>];
  } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (age &gt;= <span class="hljs-number">18</span> &amp;&amp; age &lt; <span class="hljs-number">21</span>) {
    resultParagraph.textContent = responsesArr[<span class="hljs-number">2</span>];
  } <span class="hljs-keyword">else</span> {
    resultParagraph.textContent = responsesArr[<span class="hljs-number">3</span>];
  }
  ageInput.value = <span class="hljs-string">""</span>;
}
</code></pre>
<p>The last part of this application is to add an event listener that checks when the user submits their input into the form, and display that message based on the age entered.</p>
<p>We are going to use the <code>addEventListener</code> method to listen for the <code>submit</code> event on the form. When the form is submitted, we will prevent the default behavior of the form and call the <code>displayResponse</code> function with the value of the age input.</p>
<pre><code class="lang-js">form.addEventListener(<span class="hljs-string">"submit"</span>, <span class="hljs-function">(<span class="hljs-params">e</span>) =&gt;</span> {
  e.preventDefault();
  displayResponse(ageInput.value);
});
</code></pre>
<p>Here is a complete interactive example on CodePen:</p>
<div class="embed-wrapper">
        <iframe width="100%" height="350" src="https://codepen.io/Jessica-Wilkins-the-flexboxer/embed/zYbMBaP" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="CodePen embed" scrolling="no" allowtransparency="true" allowfullscreen="true" loading="lazy"></iframe></div>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Working with comparison operators like the greater than, greater than or equal to, less than and less than or equal to operators is a common task in JavaScript. They are used to compare two values and return a Boolean value of <code>true</code> or <code>false</code> based on the comparison.</p>
<p>I hope you enjoyed this article and found it helpful.</p>
<p>Happy coding!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ What is the querySelector() Method and How Does it Work in JavaScript? ]]>
                </title>
                <description>
                    <![CDATA[ In JavaScript, there will be times when you need to access an HTML element. The querySelector method is a web API that selects the first element that matches the specified CSS selector passed into it. But how does this work in more detail? In this ar... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/queryselector-method-javascript/</link>
                <guid isPermaLink="false">66b8da36eb5fc71c855edb47</guid>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Mon, 12 Feb 2024 23:00:54 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/02/fili-santillan-qp51FQhBnS0-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In JavaScript, there will be times when you need to access an HTML element. The <code>querySelector</code> method is a web API that selects the first element that matches the specified CSS selector passed into it.</p>
<p>But how does this work in more detail? In this article, we will look at several examples on how to use the <code>querySelector</code> method as well as the <code>querySelectorAll</code> method.</p>
<h2 id="heading-basic-syntax-for-the-queryselector-method">Basic Syntax for the <code>querySelector()</code> Method</h2>
<p>The <code>querySelector</code> method is called on the <code>document</code> object and takes in an argument that represents the CSS selector of the element you want to select.</p>
<pre><code class="lang-js"><span class="hljs-built_in">document</span>.querySelector(selector);
</code></pre>
<p>If the selector matches an element within the document, the method will return the first matching element. If there are no matches, the method will return <code>null</code>.</p>
<h2 id="heading-how-to-use-the-queryselector-method-with-type-selectors">How to Use the <code>querySelector()</code> Method with Type Selectors</h2>
<p>A type selector in CSS refers to the name of an HTML element. Examples of this would be <code>button</code>, <code>div</code>, <code>p</code>, and so on.</p>
<p>In this first example, we have a button element inside the HTML document.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">button</span>&gt;</span>Show Alert<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
</code></pre>
<p>If we wanted to access that element inside our JavaScript file, we could use the <code>querySelector</code> method like this:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> buttonElement = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">"button"</span>);
</code></pre>
<p>This line of code selects the first button it sees on the page and assigns that result to a <code>const</code> variable called <code>buttonElement</code>.</p>
<p>If we log this <code>buttonElement</code> variable to the console, this would be the output:</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(buttonElement);
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Screenshot-2024-02-11-at-3.11.37-PM.png" alt="Image" width="600" height="400" loading="lazy">
<em>console.log output for querySelector example</em></p>
<p>We can use that <code>buttonElement</code> variable and add an event listener to show an <code>alert</code> when the button is clicked.</p>
<pre><code class="lang-js">buttonElement.addEventListener(<span class="hljs-string">"click"</span>, <span class="hljs-function">() =&gt;</span> {
  alert(<span class="hljs-string">"Button was clicked!"</span>);
});
</code></pre>
<p>Here is the full code and interactive example to play around with.</p>
<div class="embed-wrapper">
        <iframe width="100%" height="350" src="https://codepen.io/Jessica-Wilkins-the-flexboxer/embed/ZEPqwBg" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="CodePen embed" scrolling="no" allowtransparency="true" allowfullscreen="true" loading="lazy"></iframe></div>
<h2 id="heading-how-to-use-the-queryselector-method-with-class-selectors">How to Use the <code>querySelector()</code> Method with Class Selectors</h2>
<p>A class selector in CSS refers to the name of a class that is used in an HTML element. Examples of this would be <code>.container</code>, <code>.button</code>, and so on.</p>
<p>Let's say we want to build out a solitaire game and want to hide/show the rules of the game when a button is clicked. We could use the <code>querySelector</code> method to select the button and the rules container.</p>
<p>Here is the starting HTML:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Let's play solitaire!<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">main</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"rules-btn"</span>&gt;</span>Show Rules<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">section</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"rules-container"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>Rules to the game<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>There are 7 columns of cards<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>First column has 1 card, second has 2, third has 3, and so on<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>First card in each column is face up, rest are face down<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Move cards to build 4 stacks of cards in ascending order<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Start with aces and build up to kings<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Move cards by dragging and dropping<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">main</span>&gt;</span>
</code></pre>
<p>Inside the JavaScript file, we can use the <code>querySelector</code> method to select the rules button and the rules container.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> rulesBtn = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">".rules-btn"</span>);
<span class="hljs-keyword">const</span> rulesContainer = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">".rules-container"</span>);
</code></pre>
<p>We can then add an event listener to the <code>rulesBtn</code> variable to show/hide the rules container when the button is clicked. We are using the <code>classList</code> property to toggle the class of <code>"show"</code> on the rules container element.</p>
<pre><code class="lang-js">rulesBtn.addEventListener(<span class="hljs-string">"click"</span>, <span class="hljs-function">() =&gt;</span> {
  rulesContainer.classList.toggle(<span class="hljs-string">"show"</span>);
});
</code></pre>
<p>Here is an interactive example where you can see the rules container being shown and hidden when the button is clicked.</p>
<div class="embed-wrapper">
        <iframe width="100%" height="350" src="https://codepen.io/Jessica-Wilkins-the-flexboxer/embed/LYagqMj" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="CodePen embed" scrolling="no" allowtransparency="true" allowfullscreen="true" loading="lazy"></iframe></div>
<p>While the toggle is working here, there is a small bug in the code. By default the rules will be hidden and button text says "Show Rules". When the rules are shown, the button text should change to "Hide Rules", but right now it doesn't.</p>
<p>Inside the event listener, we can update the text content for the button to show "Hide Rules" when the rules are shown and "Show Rules" when the rules are hidden.</p>
<pre><code class="lang-js">rulesBtn.textContent = rulesContainer.classList.contains(<span class="hljs-string">"show"</span>)
  ? <span class="hljs-string">"Hide Rules"</span>
  : <span class="hljs-string">"Show Rules"</span>;
</code></pre>
<p>Now the button text will change based on the state of the rules container.<br>Here is the complete JavaScript code:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> rulesBtn = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">".rules-btn"</span>);
<span class="hljs-keyword">const</span> rulesContainer = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">".rules-container"</span>);

rulesBtn.addEventListener(<span class="hljs-string">"click"</span>, <span class="hljs-function">() =&gt;</span> {
  rulesContainer.classList.toggle(<span class="hljs-string">"show"</span>);
  rulesBtn.textContent = rulesContainer.classList.contains(<span class="hljs-string">"show"</span>)
    ? <span class="hljs-string">"Hide Rules"</span>
    : <span class="hljs-string">"Show Rules"</span>;
});
</code></pre>
<p>Here is the interactive example with the updated JavaScript code.</p>
<div class="embed-wrapper">
        <iframe width="100%" height="350" src="https://codepen.io/Jessica-Wilkins-the-flexboxer/embed/LYagqoz" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="CodePen embed" scrolling="no" allowtransparency="true" allowfullscreen="true" loading="lazy"></iframe></div>
<h2 id="heading-how-to-use-the-queryselectorall-method">How to Use the <code>querySelectorAll()</code> Method</h2>
<p>The <code>querySelectorAll</code> method is similar to the <code>querySelector</code> method, but instead of returning the first matching element, it returns a <code>NodeList</code> of all matching elements. A <code>NodeList</code> is an array-like object that contains all the elements that match the specified selector.</p>
<p>In this example we have an unordered list of sports and we want to generate random background colors for each list item.</p>
<p>Here is the starting HTML:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"btn"</span>&gt;</span>Generate Random Background Colors<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">ul</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"sports-list"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Football<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Basketball<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Tennis<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Golf<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Swimming<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</code></pre>
<p>To select all of the list items inside the unordered list, we can use the <code>querySelectorAll</code> method like this:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> sportsList = <span class="hljs-built_in">document</span>.querySelectorAll(<span class="hljs-string">".sports-list li"</span>);
</code></pre>
<p>If we log the <code>sportsList</code> variable to the console, this would be the output:</p>
<pre><code class="lang-js"><span class="hljs-built_in">console</span>.log(sportsList);
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Screenshot-2024-02-11-at-6.10.19-PM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example of NodeList</em></p>
<p>We then need to use the <code>querySelector</code> method to select the button.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> randomColorBtn = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">".btn"</span>);
</code></pre>
<p>Then, we can create a random list of colors.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> lightColorsArr = [
  <span class="hljs-string">"#FFDAB9"</span>,
  <span class="hljs-string">"#FFE4B5"</span>,
  <span class="hljs-string">"#FFFFE0"</span>,
  <span class="hljs-string">"#FAFAD2"</span>,
  <span class="hljs-string">"#F0FFF0"</span>,
  <span class="hljs-string">"#E0FFFF"</span>,
  <span class="hljs-string">"#AFEEEE"</span>,
  <span class="hljs-string">"#00CED1"</span>,
  <span class="hljs-string">"#00BFFF"</span>,
  <span class="hljs-string">"#1E90FF"</span>,
  <span class="hljs-string">"#ADD8E6"</span>,
  <span class="hljs-string">"#7FFFD4"</span>,
  <span class="hljs-string">"#7CFC00"</span>,
  <span class="hljs-string">"#7FFF00"</span>,
  <span class="hljs-string">"#32CD32"</span>,
  <span class="hljs-string">"#ADFF2F"</span>,
  <span class="hljs-string">"#FFFF00"</span>,
  <span class="hljs-string">"#FFD700"</span>,
  <span class="hljs-string">"#FFA500"</span>,
  <span class="hljs-string">"#FF6347"</span>,
];
</code></pre>
<p>Each time the user clicks on the button, we want to shuffle the list of colors and select 5 random light colors from the array. We can use the <a target="_blank" href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle">Fisher-Yates shuffle algorithm</a> to shuffle the array which is a common way to shuffle an array in JavaScript.</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">shuffleArray</span>(<span class="hljs-params">arr</span>) </span>{
  <span class="hljs-keyword">let</span> currentIndex = arr.length;
  <span class="hljs-keyword">let</span> randomIndex;

  <span class="hljs-keyword">while</span> (currentIndex !== <span class="hljs-number">0</span>) {
    randomIndex = <span class="hljs-built_in">Math</span>.floor(<span class="hljs-built_in">Math</span>.random() * currentIndex);
    currentIndex--;

    [arr[currentIndex], arr[randomIndex]] = [
      arr[randomIndex],
      arr[currentIndex],
    ];
  }

  <span class="hljs-keyword">return</span> arr;
}
</code></pre>
<p>Then we can add an event listener to the button and shuffle the array.</p>
<pre><code class="lang-js">randomColorBtn.addEventListener(<span class="hljs-string">"click"</span>, <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> shuffledColors = shuffleArray(lightColorsArr);
});
</code></pre>
<p>For each list item, we can set the background color to a random color from the shuffled array.</p>
<pre><code class="lang-js">sportsList.forEach(<span class="hljs-function">(<span class="hljs-params">list, index</span>) =&gt;</span> {
  list.style.backgroundColor = shuffledColors[index];
});
</code></pre>
<p>Here is the complete code:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> sportsList = <span class="hljs-built_in">document</span>.querySelectorAll(<span class="hljs-string">".sports-list li"</span>);
<span class="hljs-keyword">const</span> randomColorBtn = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">".btn"</span>);

<span class="hljs-built_in">console</span>.log(sportsList);

<span class="hljs-keyword">const</span> lightColorsArr = [
  <span class="hljs-string">"#FFDAB9"</span>,
  <span class="hljs-string">"#FFE4B5"</span>,
  <span class="hljs-string">"#FFFFE0"</span>,
  <span class="hljs-string">"#FAFAD2"</span>,
  <span class="hljs-string">"#F0FFF0"</span>,
  <span class="hljs-string">"#E0FFFF"</span>,
  <span class="hljs-string">"#AFEEEE"</span>,
  <span class="hljs-string">"#00CED1"</span>,
  <span class="hljs-string">"#00BFFF"</span>,
  <span class="hljs-string">"#1E90FF"</span>,
  <span class="hljs-string">"#ADD8E6"</span>,
  <span class="hljs-string">"#7FFFD4"</span>,
  <span class="hljs-string">"#7CFC00"</span>,
  <span class="hljs-string">"#7FFF00"</span>,
  <span class="hljs-string">"#32CD32"</span>,
  <span class="hljs-string">"#ADFF2F"</span>,
  <span class="hljs-string">"#FFFF00"</span>,
  <span class="hljs-string">"#FFD700"</span>,
  <span class="hljs-string">"#FFA500"</span>,
  <span class="hljs-string">"#FF6347"</span>,
];

<span class="hljs-comment">// fisher-yates shuffle algorithm</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">shuffleArray</span>(<span class="hljs-params">arr</span>) </span>{
  <span class="hljs-keyword">let</span> currentIndex = arr.length;
  <span class="hljs-keyword">let</span> randomIndex;

  <span class="hljs-keyword">while</span> (currentIndex !== <span class="hljs-number">0</span>) {
    randomIndex = <span class="hljs-built_in">Math</span>.floor(<span class="hljs-built_in">Math</span>.random() * currentIndex);
    currentIndex--;

    [arr[currentIndex], arr[randomIndex]] = [
      arr[randomIndex],
      arr[currentIndex],
    ];
  }

  <span class="hljs-keyword">return</span> arr;
}

randomColorBtn.addEventListener(<span class="hljs-string">"click"</span>, <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> shuffledColors = shuffleArray(lightColorsArr);

  sportsList.forEach(<span class="hljs-function">(<span class="hljs-params">list, index</span>) =&gt;</span> {
    list.style.backgroundColor = shuffledColors[index];
  });
});
</code></pre>
<p>Here is the interactive example with the complete JavaScript code. Click on the button and you will see the list items change to random background colors.</p>
<div class="embed-wrapper">
        <iframe width="100%" height="350" src="https://codepen.io/Jessica-Wilkins-the-flexboxer/embed/dyrgrOK" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="CodePen embed" scrolling="no" allowtransparency="true" allowfullscreen="true" loading="lazy"></iframe></div>
<h2 id="heading-conclusion">Conclusion</h2>
<p>The <code>querySelector</code> and <code>querySelectorAll</code> methods are helpful web API's that allow you to access elements in the DOM. You can use these methods to select elements by type, class, id, attribute, pseudo-class, and pseudo-element selectors.</p>
<p>I suggest you experiment with these methods and see what you can come up with in your own projects.</p>
<p>I hope you found this article helpful and informative. Happy coding!  </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Work with the Console Object in JavaScript ]]>
                </title>
                <description>
                    <![CDATA[ When you run into errors inside your code, it's important to know how to debug and find the source of the problem. The console object is a powerful tool that can help you with this. In this article, we will explore the console object and the variety ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-work-with-the-console-object-in-javascript/</link>
                <guid isPermaLink="false">66b8d9bbbb00d99843c0c43b</guid>
                
                    <category>
                        <![CDATA[ console ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Wed, 07 Feb 2024 21:29:48 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/02/computer-on-desk.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>When you run into errors inside your code, it's important to know how to debug and find the source of the problem. The <code>console</code> object is a powerful tool that can help you with this.</p>
<p>In this article, we will explore the <code>console</code> object and the variety of methods that will help you debug your code.</p>
<h2 id="heading-what-is-the-console-object">What is the <code>console</code> Object?</h2>
<p>The <code>console</code> object is a global object that provides access to the browser's debugging console. This object has a variety of methods that can be used to log messages, errors, warnings and other information to the console.</p>
<p>In this article, we will look at the more commonly used methods such as <code>console.log</code>, <code>console.warn</code>, and <code>console.error</code>.</p>
<h2 id="heading-how-to-access-the-console-in-your-browser">How to Access the Console in Your Browser</h2>
<p>To access the console in your browser, you can right click on the page and select <code>Inspect</code>. This will open the developer tools. You can also use the keyboard shortcut <code>Ctrl + Shift + I</code> on Windows or <code>Cmd + Option + I</code> on Mac.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Screenshot-2024-02-06-at-7.50.03-PM.png" alt="Console tab in Google Chrome" width="600" height="400" loading="lazy"></p>
<h2 id="heading-how-to-use-the-consolelog-method">How to Use the <code>console.log()</code> Method</h2>
<p>The most commonly used method to debug applications is the <code>console.log</code> method. This method is used to log messages and variables to the console.</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Hello, world!"</span>);
</code></pre>
<p>When you run this code in your browser, you will see the message "Hello, world!" logged to the console.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Screenshot-2024-02-06-at-7.51.44-PM.png" alt="Console statement showing Hello, World" width="600" height="400" loading="lazy"></p>
<p>This method is also useful for logging the value of variables to the console and finding bugs in your code.</p>
<p>Let's say we wanted to build out a Mad Libs generator. This is a popular game where you fill in the blanks of a story with random words.</p>
<p>Here is the code we have created so far:</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">madLibsGenerator</span>(<span class="hljs-params">verb, adjective, noun</span>) </span>{
  <span class="hljs-keyword">return</span> <span class="hljs-string">`We shall <span class="hljs-subst">${verb}</span> the<span class="hljs-subst">${adjective}</span><span class="hljs-subst">${noun}</span>.`</span>;
}

<span class="hljs-built_in">console</span>.log(madLibsGenerator(<span class="hljs-string">"dance"</span>, <span class="hljs-string">"big"</span>, <span class="hljs-string">"dog"</span>));
</code></pre>
<p>We want to see what our function is doing, so we have a <code>console.log(madLibsGenerator("dance", "big", "dog"));</code>. But when we check the console, we notice some spacing issues with the printed sentence.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Screenshot-2024-02-06-at-8.05.45-PM.png" alt="Print statement for Mad Libs generator" width="600" height="400" loading="lazy"></p>
<p>Now that we know where the issue is, we can fix those spacing issues in the function here:</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">madLibsGenerator</span>(<span class="hljs-params">verb, adjective, noun</span>) </span>{
  <span class="hljs-keyword">return</span> <span class="hljs-string">`We shall <span class="hljs-subst">${verb}</span> the <span class="hljs-subst">${adjective}</span> <span class="hljs-subst">${noun}</span>.`</span>;
}

<span class="hljs-built_in">console</span>.log(madLibsGenerator(<span class="hljs-string">"dance"</span>, <span class="hljs-string">"big"</span>, <span class="hljs-string">"dog"</span>));
</code></pre>
<p>Now the console should print the correct result.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Screenshot-2024-02-06-at-8.07.44-PM.png" alt="Correct Mad Libs result" width="600" height="400" loading="lazy"></p>
<h2 id="heading-what-is-the-consolewarn-method">What is the <code>console.warn()</code> Method?</h2>
<p>The <code>console.warn</code> method is used to log warning messages to the console. This method is useful for logging messages that are not errors, but are still important for the developer to be aware of.</p>
<p>For example, if you are building an application that is using a deprecated method, you can use the <code>console.warn</code> method to log a warning message to the console.</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.warn(
  <span class="hljs-string">"This method is deprecated and will be removed in the next version"</span>
);
</code></pre>
<p>When you run this code in your browser, you will see the warning message <code>"This method is deprecated and will be removed in the next version"</code> logged to the console.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Screenshot-2024-02-06-at-8.08.44-PM.png" alt="Console.warn method example" width="600" height="400" loading="lazy"></p>
<h2 id="heading-what-is-the-consoleerror-method">What is the <code>console.error()</code> Method?</h2>
<p>The <code>console.error</code> method is used to log error messages to the console. This method is useful for logging messages that indicate an error has occurred in your application.</p>
<p>Let's say that you have an application that is trying to fetch data from an API, but the API is down. You can use the <code>console.error</code> method to log an error message to the console.</p>
<p>Here is an example of how to use the <code>console.error</code> method to log an error message to the console:</p>
<pre><code class="lang-javascript">fetch(<span class="hljs-string">"https://api.example.com/data"</span>)
  .then(<span class="hljs-function">(<span class="hljs-params">res</span>) =&gt;</span> res.json())
  .then(<span class="hljs-function">(<span class="hljs-params">data</span>) =&gt;</span> <span class="hljs-built_in">console</span>.log(data))
  .catch(<span class="hljs-function">(<span class="hljs-params">error</span>) =&gt;</span>
    <span class="hljs-built_in">console</span>.error(<span class="hljs-string">"There was an error fetching the data"</span>, error)
  );
</code></pre>
<p>If there is an error fetching the data from the API, you will see the error message <code>"There was an error fetching the data"</code> logged to the console.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Screenshot-2024-02-06-at-8.09.28-PM.png" alt="Example of failed error message" width="600" height="400" loading="lazy"></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>There are so many more methods that you can use with the <code>console</code> object to help you debug your code. In this article, we have only scratched the surface.</p>
<p>To learn more about the <code>console</code> object and the variety of methods that you can use, check out the <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/Console">MDN docs</a>.</p>
<p>I encourage you to play around with the <code>console</code> object and the variety of methods that it has to offer. It is a powerful tool that will help you debug your code and find the source of any issues that you may run into.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ What is box-sizing: border-box in CSS? ]]>
                </title>
                <description>
                    <![CDATA[ In CSS, there is a property called box-sizing that allows you to determine how the width and the height for an element is calculated.  A lot of CSS resets will change the default box model from content-box to border-box to make the layouts easier to ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/what-is-box-sizing-border-box-css/</link>
                <guid isPermaLink="false">66b8da708cd1c2aa053d49c1</guid>
                
                    <category>
                        <![CDATA[ CSS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Mon, 05 Feb 2024 18:26:43 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/02/curology-fPSELOXfeU4-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In CSS, there is a property called <code>box-sizing</code> that allows you to determine how the width and the height for an element is calculated. </p>
<p>A lot of <a target="_blank" href="https://www.freecodecamp.org/news/how-i-style-my-websites-with-my-favorite-css-resets-7ace41dbc43d/">CSS resets</a> will change the default box model from <code>content-box</code> to <code>border-box</code> to make the layouts easier to work with.</p>
<p>But what does <code>box-sizing: border-box</code> actually do?</p>
<p>In this article, we will explore the <code>box-sizing</code> property and how it affects the layout for your web pages.</p>
<h2 id="heading-the-default-box-model">The Default Box Model</h2>
<p>The default box model is set to <code>content-box</code>. This means that the width and height of an element are calculated based on the content inside the element.</p>
<p>If you add any padding or border to the element, then those values will be added to the final width of the element. </p>
<p>In this example, we have a red box that has a width of 200px, height of 200px, padding of 20px, and a black border set to 5px.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span> {
  <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#ff0000</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">200px</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">200px</span>;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">20px</span>;
  <span class="hljs-attribute">border</span>: <span class="hljs-number">5px</span> solid black;
}
</code></pre>
<div class="embed-wrapper">
        <iframe width="100%" height="350" src="https://codepen.io/jessica-wilkins/embed/RwdyYmq" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="CodePen embed" scrolling="no" allowtransparency="true" allowfullscreen="true" loading="lazy"></iframe></div>
<p>If you right click on the <code>div</code> element and inspect it inside the dev tools, you will see that the width of the box is 250px and the height is 250px. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Screenshot-2024-02-04-at-9.12.12-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>example of box set to 250px by 250px</em></p>
<p>This is because the padding and border are added to the width and height of the box. The total width and height are now 250px by 250px instead of 200px.   </p>
<p>When you are building out your layouts, you have to remember to calculate the padding and border into the width and height of the element. This can be a bit of a pain and can lead to unexpected results.</p>
<p>A way to avoid this is to use the <code>box-sizing</code> property set to <code>border-box</code>.</p>
<h2 id="heading-how-to-work-with-box-sizing-border-box">How to Work with <code>box-sizing: border-box</code></h2>
<p>When you set the <code>box-sizing</code> property to <code>border-box</code>, the width and height of the element are calculated based on the content, padding and border of the element.</p>
<p>In this revised example, we are using the <code>*</code> selector to set the <code>box-sizing</code> property to <code>border-box</code> for all elements on the page. This is known as a global CSS reset.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<pre><code class="lang-css">*,
*<span class="hljs-selector-pseudo">:before</span>,
*<span class="hljs-selector-pseudo">:after</span> {
  <span class="hljs-attribute">box-sizing</span>: border-box;
}

<span class="hljs-selector-class">.box</span> {
  <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#ff0000</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">200px</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">200px</span>;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">20px</span>;
  <span class="hljs-attribute">border</span>: <span class="hljs-number">5px</span> solid black;
}
</code></pre>
<div class="embed-wrapper">
        <iframe width="100%" height="350" src="https://codepen.io/jessica-wilkins/embed/rNRvZXm?editors=1100" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="CodePen embed" scrolling="no" allowtransparency="true" allowfullscreen="true" loading="lazy"></iframe></div>
<p>Now when you inspect the box element, you will see that the width and height are set to 200px like we specified in the stylesheet. The browser is accounting for the added padding and border and adjusting the content box accordingly. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Screenshot-2024-02-04-at-9.28.29-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>example of dev tools showing box width of 200px</em></p>
<h3 id="heading-what-do-the-before-and-after-selectors-do">What do the <code>*</code>, <code>*:before</code> and <code>*:after</code> selectors do?</h3>
<p>The reason why we are using the <code>*</code>, <code>*:before</code> and <code>*:after</code> selectors is to ensure that the <code>border-box</code> value is applied to all elements on the page. </p>
<p>The <code>*</code> selector selects all elements, the <code>*:before</code> selector selects all elements before the content, and the <code>*:after</code> selector selects all elements after the content. </p>
<p>To learn more about the <code>:before</code> and <code>:after</code> pseudo elements, check out <a target="_blank" href="https://www.freecodecamp.org/news/css-pseudo-elements-before-and-after-selectors-explained/">this freeCodeCamp article</a>.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Having to remember to calculate the padding and border into the width and height of your elements can be a pain and lead to unexpected results in your layouts.  </p>
<p>Setting the <code>box-sizing</code> property to <code>border-box</code> for all elements on the page by using the <code>*</code>, <code>*:before</code> and <code>*:after</code> selectors will save you a lot of time debugging and fixing layout issues in your CSS.  </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Learn JavaScript by Building 21 Projects – a Major freeCodeCamp Curriculum Upgrade ]]>
                </title>
                <description>
                    <![CDATA[ freeCodeCamp just launched a major upgrade to our JavaScript Algorithms and Data Structures Certification. You can now learn JavaScript by building 21 projects! https://www.youtube.com/watch?v=D8pqkmZWc9o Instead of coding through a series of challen... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/learn-javascript-with-new-data-structures-and-algorithms-certification-projects/</link>
                <guid isPermaLink="false">66b8d9fc6b74ac70ba21e6c9</guid>
                
                    <category>
                        <![CDATA[ freeCodeCamp.org ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Wed, 20 Dec 2023 15:00:26 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/12/JavaScript-Curriculum.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>freeCodeCamp just launched a major upgrade to our <a target="_blank" href="https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/">JavaScript Algorithms and Data Structures Certification</a>. You can now learn JavaScript by building 21 projects!</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/D8pqkmZWc9o" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p>Instead of coding through a series of challenges, you will learn the fundamentals of JavaScript by building 16 practice projects + 5 certification projects. Each of the practice projects will lead you through a step by step process for building out dynamic HTML, CSS and JavaScript applications.</p>
<p>Also note that any older certifications you have earned will continue to remain valid going forward. </p>
<p>I have created a video walkthrough demoing each of the projects that you will build throughout this course.</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/n8mNX2YqkUs" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p>Here is the complete list of projects you will build:</p>
<ol>
<li><a class="post-section-overview" href="#heading-learn-basic-javascript-by-building-a-role-playing-game">Learn Basic JavaScript by Building a Role Playing Game</a></li>
<li><a class="post-section-overview" href="#heading-learn-form-validation-by-building-a-calorie-counter">Learn Form Validation by Building a Calorie Counter</a></li>
<li><a class="post-section-overview" href="#heading-learn-basic-string-and-array-methods-by-building-a-music-player">Learn Basic String and Array Methods by Building a Music Player</a></li>
<li><a class="post-section-overview" href="#heading-learn-the-date-object-by-building-a-date-formatter">Learn the Date Object By Building a Date Formatter</a></li>
<li><a class="post-section-overview" href="#heading-certification-project-build-a-palindrome-checker">Build a Palindrome Checker - <strong>Certification project</strong></a></li>
<li><a class="post-section-overview" href="#heading-learn-modern-javascript-methods-by-building-football-team-cards">Learn Modern JavaScript Methods By Building Football Team Cards</a></li>
<li><a class="post-section-overview" href="#heading-learn-localstorage-by-building-a-todo-list">Learn localStorage by Building a Todo List</a></li>
<li><a class="post-section-overview" href="#heading-learn-recursion-by-building-a-decimal-to-binary-converter">Learn Recursion by Building a Decimal to Binary Converter</a></li>
<li><a class="post-section-overview" href="#heading-certification-project-build-a-roman-numeral-converter">Build a Roman Numeral Converter - <strong>Certification project</strong></a></li>
<li><a class="post-section-overview" href="#heading-learn-basic-algorithmic-thinking-by-building-a-number-sorter">Learn Basic Algorithmic Thinking by Building a Number Sorter</a></li>
<li><a class="post-section-overview" href="#heading-learn-advanced-array-methods-by-building-a-statistics-calculator">Learn Advanced Array Methods by Building a Statistics Calculator</a></li>
<li><a class="post-section-overview" href="#heading-learn-functional-programming-by-building-a-spreadsheet">Learn Functional Programming by Building a Spreadsheet</a></li>
<li><a class="post-section-overview" href="#heading-learn-regular-expressions-by-building-a-spam-filter">Learn Regular Expressions by Building a Spam Filter</a></li>
<li><a class="post-section-overview" href="#heading-certification-project-telephone-number-validator">Build a Telephone Number Validator - <strong>Certification Project</strong></a></li>
<li><a class="post-section-overview" href="#heading-learn-basic-oop-by-building-a-shopping-cart">Learn Basic OOP by Building a Shopping Cart</a></li>
<li><a class="post-section-overview" href="#heading-learn-intermediate-oop-by-building-a-platformer-game">Learn Intermediate OOP by Building a Platformer Game</a> </li>
<li><a class="post-section-overview" href="#heading-learn-intermediate-algorithmic-thinking-by-building-a-dice-game">Learn Intermediate Algorithmic Thinking by Building a Dice Game</a></li>
<li><a class="post-section-overview" href="#heading-certification-project-build-a-cash-register">Build a Cash Register - <strong>Certification Project</strong></a> </li>
<li><a class="post-section-overview" href="#heading-learn-fetch-and-promises-by-building-an-fcc-authors-page">Learn Fetch and Promises by Building an fCC Authors Page</a></li>
<li><a class="post-section-overview" href="#heading-learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard">Learn Asynchronous programming by Building an fCC Forum Leaderboard</a></li>
<li><a class="post-section-overview" href="#heading-certification-project-build-a-pokemon-search-app">Build a Pokémon Search App - <strong>Certification Project</strong></a> </li>
</ol>
<h2 id="heading-learn-basic-javascript-by-building-a-role-playing-game">Learn Basic JavaScript by Building a Role Playing Game</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-6.07.46-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for the JavaScript Role Playing Game</em></p>
<p>For the first project, you'll learn fundamental programming concepts in JavaScript by coding your own Role Playing Game. You'll learn how to work with arrays, strings, objects, functions, loops, if/else statements, and more.</p>
<p>You will start off by building the HTML and CSS structure inside the freeCodeCamp editor. Then you will move onto building out the JavaScript functionality.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-6.14.47-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Step 53 for the JavaScript Role Playing Game</em></p>
<p>This project will give you tons of repetition and practice working with the basics of JavaScript. And if you get stuck on a step, then you will be guided to the solution through a series of hints. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-6.13.02-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Hint for the JavaScript Role Playing Game in freeCodeCamp editor</em></p>
<h2 id="heading-learn-form-validation-by-building-a-calorie-counter">Learn Form Validation by Building a Calorie Counter</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-6.29.25-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>JavaScript Calorie Counter Project</em></p>
<p>In this calorie counter project, you’ll learn how to validate user input, perform calculations based on that input, and dynamically update your interface to display the results. This project covers basic regular expressions, template literals, the <code>addEventListener()</code> method, and more.</p>
<h2 id="heading-learn-basic-string-and-array-methods-by-building-a-music-player">Learn Basic String and Array Methods by Building a Music Player</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-6.36.48-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>JavaScript Music Player Project</em></p>
<p>In this project, you’ll code a basic MP3 player using HTML, CSS, and JavaScript. The project covers fundamental concepts such as handling audio playback, managing a playlist, implementing play, pause, next, previous, and shuffle functionalities. </p>
<p>You will learn how to work with essential string and array methods like the <code>find()</code>, <code>forEach()</code>, <code>map()</code>, and <code>join()</code>. </p>
<h2 id="heading-learn-the-date-object-by-building-a-date-formatter">Learn the Date Object By Building a Date Formatter</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-6.41.50-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>JavaScript Date formatter project</em></p>
<p>In this project, you’ll learn how to work with the JavaScript <code>Date</code> object, including its methods and properties. You’ll also learn how to correctly format dates.</p>
<p>This project will cover concepts such as the <code>getDate()</code>, <code>getMonth()</code>, and <code>getFullYear()</code> methods.</p>
<h2 id="heading-certification-project-build-a-palindrome-checker">Certification project: Build a Palindrome Checker</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-6.48.04-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Palindrome Checker Preview</em></p>
<p>For this certification project, you will build out a palindrome checker. A user should be able to input a word or phrase and your application should correctly check if is a palindrome. </p>
<p>A <em>palindrome</em> is a word or phrase that can be read the same way forwards and backwards, ignoring punctuation, case, and spacing.</p>
<p>This is one of the five certification projects that count towards earning the JavaScript Algorithms and Data Structures Certification.</p>
<h2 id="heading-learn-modern-javascript-methods-by-building-football-team-cards">Learn Modern JavaScript Methods By Building Football Team Cards</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-6.52.26-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for the Football team cards project</em></p>
<p>In this football team cards project, you'll learn how to work with DOM manipulation, object destructuring, event handling, and data filtering.  </p>
<p>This project will cover concepts like <code>switch</code> statements, default parameters, <code>Object.freeze()</code>, the <code>map()</code> method, and more.</p>
<h2 id="heading-learn-localstorage-by-building-a-todo-list">Learn localStorage by Building a Todo List</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-6.54.37-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for TODO app</em></p>
<p>Local storage is a web browser feature that lets web applications store key-value pairs persistently within a user's browser. This allows web apps to save data during one session, then retrieve it in a later page session.</p>
<p>In this TODO application, you’ll learn how to handle form inputs, manage local storage, perform CRUD (Create, Read, Update, Delete) operations on tasks, implementing event listeners, and toggle UI elements.</p>
<h2 id="heading-learn-recursion-by-building-a-decimal-to-binary-converter">Learn Recursion by Building a Decimal to Binary Converter</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-9.46.45-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for decimal to binary converter</em></p>
<p>Recursion is a programming concept where a function calls itself. This can reduce a complex problem into simpler sub-problems, until they become straightforward to solve.</p>
<p>In this project, you’ll build a decimal-to-binary converter using JavaScript. You’ll learn the fundamental concepts of recursion, explore the call stack, and build out a visual representation of the recursion process through an animation.</p>
<h2 id="heading-certification-project-build-a-roman-numeral-converter">Certification Project: Build a Roman Numeral Converter</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-8.31.11-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for Roman numeral project</em></p>
<p>For this certification project, you will build out a Roman numeral converter. A user should be able to input an integer and your application should correctly return a Roman numeral. </p>
<p>This is one of the five certification projects that count towards earning the JavaScript Algorithms and Data Structures Certification.</p>
<h2 id="heading-learn-basic-algorithmic-thinking-by-building-a-number-sorter">Learn Basic Algorithmic Thinking by Building a Number Sorter</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-8.43.49-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for number sorter project</em></p>
<p>In computer science, there are fundamental sorting algorithms that all developers should learn. In this number sorter project, you’ll learn how to implement and visualize different sorting algorithms like bubble sort, selection sort, and insertion sort – all with JavaScript.</p>
<p>This project will help you understand the fundamental concepts behind these algorithms, and how you can apply them to sort numerical data in web applications.</p>
<h2 id="heading-learn-advanced-array-methods-by-building-a-statistics-calculator">Learn Advanced Array Methods by Building a Statistics Calculator</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-8.49.16-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for Statistics Calculator</em></p>
<p>In this statistics calculator project, you'll gain experience with handling user input, DOM manipulation, and method chaining. You’ll get practice by performing statistical calculations like mean, median, mode, variance, and standard deviation.</p>
<h2 id="heading-learn-functional-programming-by-building-a-spreadsheet">Learn Functional Programming by Building a Spreadsheet</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-8.58.39-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview of Spreadsheet project</em></p>
<p>In Functional Programming, developers organize code into smaller functions, then combine those functions to build complex programs.</p>
<p>In this spreadsheet application project, you'll learn about parsing and evaluating mathematical expressions, implementing spreadsheet functions, handling cell references, and creating interactive web interfaces. You’ll learn how to dynamically update the page based on user input.</p>
<p>This project will cover concepts like the <code>map()</code> method, <code>find()</code> method, <code>parseInt()</code>, the <code>includes()</code> method.</p>
<h2 id="heading-learn-regular-expressions-by-building-a-spam-filter">Learn Regular Expressions by Building a Spam Filter</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-9.01.13-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview of Spam filter project</em></p>
<p>Regular expressions, often shortened to "regex" or "regexp", are patterns that help programmers match, search, and replace text. Regular expressions are powerful, but can be difficult to understand because they use so many special characters.</p>
<p>In this spam filter project, you'll learn about capture groups, positive lookaheads, negative lookaheads, and other techniques to match any text you want.</p>
<h2 id="heading-certification-project-telephone-number-validator">Certification Project: Telephone Number Validator</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-9.04.28-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview of Telephone number validator</em></p>
<p>For this certification project, you will build out a telephone number validator. A user should be able to input a number or random set of characters and your application should correctly check if it is a valid United States phone number or not. </p>
<p>This is one of the five certification projects that count towards earning the JavaScript Algorithms and Data Structures Certification.</p>
<h2 id="heading-learn-basic-oop-by-building-a-shopping-cart">Learn Basic OOP by Building a Shopping Cart</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-9.07.18-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview of Shopping cart project</em></p>
<p>OOP, or Object Oriented Programming, is one of the major approaches to the software development process. In OOP, developers use objects and classes to structure their code.</p>
<p>In this shopping cart project, you'll learn how to define classes and use them. You’ll create class instances and implement methods for data manipulation. </p>
<p>This project will cover concepts like the <code>ternary</code> operator, the <code>spread</code> operator, the <code>this</code> keyword, and more.</p>
<h2 id="heading-learn-intermediate-oop-by-building-a-platformer-game">Learn Intermediate OOP by Building a Platformer Game</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-9.10.57-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview of the Platfomer game</em></p>
<p>In this platformer game project, you’ll continue to learn about classes, objects, inheritance, and encapsulation. You’ll also learn how to design and organize game elements efficiently and gain insights into problem-solving and code reusability.</p>
<h2 id="heading-learn-intermediate-algorithmic-thinking-by-building-a-dice-game">Learn Intermediate Algorithmic Thinking by Building a Dice Game</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-9.13.36-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for the Dice game</em></p>
<p>Algorithmic thinking involves the ability to break down complex problems into a sequence of well-defined, step-by-step instructions.</p>
<p>In this Dice game project, you’ll learn how to manage game state, implement game logic for rolling dice, keeping score, and applying rules for various combinations.</p>
<p>This project covers concepts such as event handling, array manipulation, conditional logic, and updating the user interface dynamically based on game state.</p>
<h2 id="heading-certification-project-build-a-cash-register">Certification Project: Build a Cash Register</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-9.32.34-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for the cash register</em></p>
<p>For this certification project, you will build out a functioning cash register. A user should be able to input cash and the register should output if any change is due and what amount. </p>
<p>This is one of the five certification projects that count towards earning the JavaScript Algorithms and Data Structures Certification.</p>
<h2 id="heading-learn-fetch-and-promises-by-building-an-fcc-authors-page">Learn Fetch and Promises by Building an fCC Authors Page</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-9.36.34-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for freeCodeCamp authors page project</em></p>
<p>One common aspect of web development is learning how to fetch data from an external API, then work with asynchronous JavaScript. </p>
<p>This freeCodeCamp authors page project will show you how to use the fetch method, then dynamically update the DOM to display the fetched data. This project will also teach you how to paginate your data so you can load results in batches.</p>
<h2 id="heading-learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard">Learn Asynchronous Programming by Building an fCC Forum Leaderboard</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-9.39.49-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for forum leaderboard project</em></p>
<p>In this project you will gain proficiency in asynchronous concepts by building your own freeCodeCamp forum leaderboard.  This project will cover the <code>Fetch API</code>, promises, <code>Async/Await</code>, and the <code>try...catch</code> statement.</p>
<h2 id="heading-certification-project-build-a-pokemon-search-app">Certification Project: Build a Pokémon Search App</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/12/Screenshot-2023-12-18-at-9.41.17-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Preview for Pokémon Search App</em></p>
<p>For this certification project, you will build out a Pokémon Search App. A user should be able to enter in the name or id for a Pokémon and your application should return the stats and avatar for that Pokémon.</p>
<p>This is one of the five certification projects that count towards earning the JavaScript Algorithms and Data Structures Certification.</p>
<h2 id="heading-try-the-new-javascript-algorithms-and-data-structures-certification">Try the New JavaScript Algorithms and Data Structures Certification</h2>
<p>This certification is currently in beta. If you find any issues, please report them to our <a target="_blank" href="https://github.com/freeCodeCamp/freeCodeCamp/issues">GitHub repository</a>. </p>
<p>If you need help with any of the projects, reach out on the <a target="_blank" href="https://forum.freecodecamp.org/">freeCodeCamp forum</a>.</p>
<p>When you are ready, you can dive right into the new <a target="_blank" href="https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/">JavaScript Algorithms and Data Structures Certification</a>. </p>
<h3 id="heading-this-is-only-the-beginning">This is only the beginning</h3>
<p>We'll be working throughout 2024 and 2025 to help as many developers as possible improve their JavaScript skills.</p>
<p>You can get involved in our open source efforts by <a target="_blank" href="https://contribute.freecodecamp.org/#/">becoming a volunteer in the freeCodeCamp community</a>.</p>
<p>And if you want to help us speed up development of our JavaScript curriculum, and the <a target="_blank" href="https://www.freecodecamp.org/news/a-very-freecodecamp-christmas/">many other initiatives we have underway</a>, you should <a target="_blank" href="https://www.freecodecamp.org/donate">become a monthly supporter of our charity</a>.</p>
<p>Happy coding. 🏕️</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Build a Visualization for Leetcode's Two Sum Problem – HTML, CSS, & JavaScript Project ]]>
                </title>
                <description>
                    <![CDATA[ With the current state of the job market, there are a lot of people grinding out LeetCode as a way to prepare for technical interviews.  But sometimes it would be nice if there were a visualization showing the algorithms behind these problems.  In th... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/build-a-visualization-for-leetcode-two-sum-problem/</link>
                <guid isPermaLink="false">66b8d935d482a18d3e028263</guid>
                
                    <category>
                        <![CDATA[ coding interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ data visualization ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ leetcode ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Tue, 21 Nov 2023 21:08:22 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/11/nubelson-fernandes--Xqckh_XVU4-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>With the current state of the job market, there are a lot of people grinding out <a target="_blank" href="https://leetcode.com/">LeetCode</a> as a way to prepare for technical interviews. </p>
<p>But sometimes it would be nice if there were a visualization showing the algorithms behind these problems. </p>
<p>In this tutorial, we will build out a <a target="_blank" href="https://codepen.io/Jessica-Wilkins-the-decoder/full/eYxVyKN">visualization</a> showing a couple of approaches to a popular LeetCode problem called <a target="_blank" href="https://leetcode.com/problems/two-sum/">Two Sum</a>. We will use vanilla HTML, CSS, and JavaScript to build this project out. </p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><a class="post-section-overview" href="#heading-prerequisites">Prerequisites</a></li>
<li><a class="post-section-overview" href="#heading-project-setup">Project Setup</a></li>
<li><a class="post-section-overview" href="#heading-how-to-solve-leetcodes-two-sum-problem">How to Solve LeetCode's Two Sum Problem</a><ul>
<li><a class="post-section-overview" href="#heading-description">Description</a></li>
<li><a class="post-section-overview" href="#heading-brute-force-approach">Brute Force Approach</a></li>
<li><a class="post-section-overview" href="#heading-brute-force-javascript-solution-and-time-complexity">Brute Force JavaScript Solution and Time Complexity</a></li>
<li><a class="post-section-overview" href="#heading-map-approach-and-solution">Map Approach and Solution</a></li>
<li><a class="post-section-overview" href="#heading-time-complexity-for-the-map-solution">Time Complexity for the Map Solution</a></li>
</ul>
</li>
<li><a class="post-section-overview" href="#heading-overview-for-the-two-sum-visualization">Overview  for the Two Sum Visualization</a></li>
<li><a class="post-section-overview" href="#heading-adding-the-brute-force-visualization">Adding the Brute Force Visualization</a><ul>
<li><a class="post-section-overview" href="#heading-creating-the-const-and-let-variables">Creating the const and let Variables</a></li>
<li><a class="post-section-overview" href="#heading-creating-the-getclassname-function">Creating the getClassName Function</a></li>
<li><a class="post-section-overview" href="#heading-creating-the-bruteforceapproach-function">Creating the bruteForceApproach Function</a></li>
</ul>
</li>
<li><a class="post-section-overview" href="#heading-how-to-disable-the-bruteforcesolutionbtn-when-the-animation-is-in-progress">How to Disable the bruteForceSolutionBtn When the Animation is in Progress</a></li>
<li><a class="post-section-overview" href="#heading-adding-the-map-solution-visualization">Adding the Map Solution Visualization</a><ul>
<li><a class="post-section-overview" href="#heading-creating-the-const-variables">Creating the const Variables</a></li>
<li><a class="post-section-overview" href="#heading-creating-the-optimalapproach-async-function">Creating the optimalApproach Async Function</a></li>
</ul>
</li>
<li><a class="post-section-overview" href="#heading-how-to-reset-the-table-output-for-the-map-solution">How to Reset the Table Output for the Map Solution</a></li>
<li><a class="post-section-overview" href="#heading-final-solution-code-and-live-example">Final Solution Code and Live Example</a></li>
<li><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></li>
</ul>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>This tutorial assumes that you have basic knowledge of HTML, CSS and JavaScript. If you haven't gone through a beginner course in any of those languages, then I would suggest starting with these resources:</p>
<ul>
<li><a target="_blank" href="https://www.freecodecamp.org/learn/2022/responsive-web-design/">freeCodeCamp's Responsive Web Design Certification</a></li>
<li><a target="_blank" href="https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/">freeCodeCamp's JavaScript Algorithms and Data Structures Certification</a></li>
</ul>
<p>This tutorial also assumes that you have some basic knowledge of how to work with a code editor or IDE. If not, then I would suggest looking into these resources:</p>
<ul>
<li><a target="_blank" href="https://www.youtube.com/watch?v=WPqXP_kLzpo">Visual Studio Code Crash Course</a></li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/how-to-use-codepen/">How to Use CodePen</a> </li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/how-to-use-replit/">How to Use Replit</a></li>
</ul>
<h2 id="heading-project-setup">Project Setup</h2>
<p>You are free to build out this project in either your local code editor of choice, or through an online IDE or editor like <a target="_blank" href="https://codepen.io/">CodePen</a>, <a target="_blank" href="https://codesandbox.io/">CodeSandbox</a>, or <a target="_blank" href="https://replit.com/">Replit</a>. </p>
<p>This project will consist of three files: <code>index.html</code>, <code>index.js</code>, and <code>styles.css</code>. Since this project is going to mainly focus on JavaScript, I have supplied all of the HTML and CSS in <a target="_blank" href="https://github.com/jdwilkin4/leetcode-two-sum-starter-code">this GitHub repo here</a>. </p>
<p>You are free to <a target="_blank" href="https://www.freecodecamp.org/news/how-to-fork-a-github-repository/">fork</a> and <a target="_blank" href="https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository">clone</a> the repository, or you can copy the code found in the HTML and CSS files and add it to your project.</p>
<p>Once you get your project environment setup, then you should start the local server and see this result on the screen:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/Screenshot-2023-11-19-at-4.18.24-PM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Visualization styles for Leetcode's Two Sum problem</em></p>
<h2 id="heading-how-to-solve-leetcodes-two-sum-problem">How to Solve LeetCode's Two Sum problem</h2>
<p>Before we can build out the visualization for this problem, we need to first understand and solve the problem.</p>
<h3 id="heading-description">Description</h3>
<p>For this problem, you will be given a list of numbers in any order and a target number. The goal is to find the pair of numbers that adds up to the target and return an array of indices for that pair of numbers.</p>
<p>In this example, we have the following list and target number:</p>
<pre><code class="lang-js">[<span class="hljs-number">2</span>,<span class="hljs-number">7</span>,<span class="hljs-number">11</span>,<span class="hljs-number">15</span>]
<span class="hljs-attr">target</span>: <span class="hljs-number">9</span>
</code></pre>
<p>The numbers 2 and 7 equal 9 so we would return <code>[0,1]</code> because that represents the indices for where the pair of numbers can be found in the array. </p>
<p>For this problem, you can assume there will be at least two numbers or more in the array and there will only be <strong>one</strong> possible solution. </p>
<p>So for example you can not have this input here which produces no solution because there are no two numbers in that list that add up to the target.</p>
<pre><code class="lang-js">[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>]
<span class="hljs-attr">target</span>: <span class="hljs-number">55</span>
</code></pre>
<p>You will also not get an input with multiple solutions. The following input has two answers of <code>[0,1]</code> and <code>[1,2]</code> which goes against the rules of this problem. </p>
<pre><code class="lang-js">[<span class="hljs-number">3</span>,<span class="hljs-number">3</span>,<span class="hljs-number">3</span>]
<span class="hljs-attr">target</span>: <span class="hljs-number">6</span>
</code></pre>
<h3 id="heading-brute-force-approach">Brute Force Approach</h3>
<p>The more intuitive approach would be to start at the beginning of the list of numbers and compare each possible pair of numbers until we find the pair that adds up to the target. </p>
<p>Let's take a look at this example here:</p>
<pre><code class="lang-js">[<span class="hljs-number">11</span>, <span class="hljs-number">15</span>, <span class="hljs-number">2</span>, <span class="hljs-number">7</span>]
<span class="hljs-attr">target</span>:<span class="hljs-number">9</span>
</code></pre>
<p>We can start with the first number in the list (11) and check each possible pair and see if it adds up to the target number (9).</p>
<pre><code><span class="hljs-number">11</span> + <span class="hljs-number">15</span> = <span class="hljs-number">9</span>? NO
<span class="hljs-number">11</span> + <span class="hljs-number">2</span> = <span class="hljs-number">9</span>? NO
<span class="hljs-number">11</span> + <span class="hljs-number">7</span> = <span class="hljs-number">9</span>? NO
</code></pre><p>Since none of those pairs equal the target (9), then we move to the second number in the list (15) and check all possible pairs. There is no need to check 11+15 because we already checked that earlier.</p>
<pre><code><span class="hljs-number">15</span> + <span class="hljs-number">2</span> = <span class="hljs-number">9</span>? NO
<span class="hljs-number">15</span> + <span class="hljs-number">7</span> = <span class="hljs-number">9</span>? NO
</code></pre><p>Since none of those pairs equal the target (9), then we move to the third number in the list (2) and check all possible pairs.</p>
<pre><code><span class="hljs-number">2</span> + <span class="hljs-number">7</span> = <span class="hljs-number">9</span>? YES!!!
</code></pre><p>Now, we have found the pair that adds up to the target we would return <code>[2,3]</code> because that represents the indices for where the pair of numbers can be found in the array. </p>
<h3 id="heading-brute-force-javascript-solution-and-time-complexity">Brute Force JavaScript Solution and Time Complexity</h3>
<p>This solution uses a nested <code>for</code> loop which would be an O(n²) time complexity. The outer loop is used to get the current number in the list and the inner loop is used to check if the sum of the current number and other numbers in the list add up to the target.</p>
<pre><code class="lang-js"><span class="hljs-comment">/**
 * <span class="hljs-doctag">@param <span class="hljs-type">{number[]}</span> <span class="hljs-variable">nums</span></span>
 * <span class="hljs-doctag">@param <span class="hljs-type">{number}</span> <span class="hljs-variable">target</span></span>
 * <span class="hljs-doctag">@return <span class="hljs-type">{number[]}</span></span>
 */</span>

<span class="hljs-keyword">var</span> twoSum = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">nums, target</span>) </span>{
  <span class="hljs-keyword">if</span> (nums.length === <span class="hljs-number">2</span>) <span class="hljs-keyword">return</span> [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>];

  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; nums.length; i++) {
    <span class="hljs-keyword">const</span> currentNum = nums[i];
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> j = i + <span class="hljs-number">1</span>; j &lt; nums.length; j++) {
      <span class="hljs-keyword">if</span> (currentNum + nums[j] === target) <span class="hljs-keyword">return</span> [i, j];
    }
  }
};
</code></pre>
<p><strong>Note:</strong> I have added an additional check in my solution to check if the input array has only two numbers. In that case, we immediately return <code>[0,1]</code> because those are the only possible indices for that test case. </p>
<pre><code class="lang-js"> <span class="hljs-keyword">if</span> (nums.length === <span class="hljs-number">2</span>) <span class="hljs-keyword">return</span> [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>];
</code></pre>
<p>So far, our input arrays have been very small. But if we had an input array of 100, 500, or 1000+ numbers, then it could take a while to find the pair that adds up to the target. </p>
<p>In the next section, we are going to take a look at a solution that utilizes JavaScript's <code>Map</code> object and runs in linear time O(n).</p>
<h3 id="heading-map-approach-and-solution">Map Approach and Solution</h3>
<p>In the brute force approach, we started at the beginning of the array and compared all possible pairs of numbers until we found the pair that added up to the target. But in this approach we can use JavaScript's <code>Map</code> object and one <code>for</code> loop to find that pair.</p>
<p>JavaScript's <code>Map</code> object is a collection of key-value pairs that allows for quick lookups and has built in methods like <code>set()</code>, <code>get()</code> and <code>has()</code>.</p>
<p>Let's work with the same example from earlier:</p>
<pre><code class="lang-js">[<span class="hljs-number">11</span>, <span class="hljs-number">15</span>, <span class="hljs-number">2</span>, <span class="hljs-number">7</span>]
<span class="hljs-attr">target</span>:<span class="hljs-number">9</span>
</code></pre>
<p>We can start looping through the array and look at the current number in the list which would be <code>nums[i]</code>. We also want to create a new <code>map</code> object which will be empty to start.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> map = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();

<span class="hljs-keyword">for</span>(<span class="hljs-keyword">let</span> i=<span class="hljs-number">0</span>; i&lt;nums.length; i++){

}
</code></pre>
<p>Inside our loop, we need to calculate the difference which will be the target minus the current number.</p>
<pre><code class="lang-js">    <span class="hljs-keyword">const</span> map = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();

    <span class="hljs-keyword">for</span>(<span class="hljs-keyword">let</span> i=<span class="hljs-number">0</span>; i&lt;nums.length; i++){
        <span class="hljs-keyword">const</span> difference = target - nums[i]
    }
</code></pre>
<p>Since we know there can only be two numbers that add up to the target, we can check if the difference is in the <code>map</code>. If so, we have found the pair and can return the indices. Otherwise, we can add that current number to the <code>map</code> along with its index.</p>
<pre><code class="lang-js">    <span class="hljs-keyword">const</span> map = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();

    <span class="hljs-keyword">for</span>(<span class="hljs-keyword">let</span> i=<span class="hljs-number">0</span>; i &lt; nums.length; i++) {
        <span class="hljs-keyword">const</span> difference = target - nums[i]

        <span class="hljs-keyword">if</span>(map.has(difference)) {
            <span class="hljs-keyword">return</span> [map.get(difference), i]
        } <span class="hljs-keyword">else</span> {
            map.set(nums[i], i)
        }
    }
</code></pre>
<p>In the following code, the <code>has()</code> method is used to check if the following <code>key</code> is in the <code>map</code> object. This method will return a boolean of true or false. </p>
<pre><code class="lang-js">map.has(difference)
</code></pre>
<p>The <code>get()</code> method is used to return that element from the <code>map</code>. </p>
<pre><code class="lang-js"> <span class="hljs-keyword">if</span>(map.has(difference)) {
   <span class="hljs-keyword">return</span> [map.get(difference), i]
 }
</code></pre>
<p>The <code>set()</code> method will add or update an entry in the <code>map</code> with a key and value.</p>
<pre><code class="lang-js"><span class="hljs-keyword">else</span> {
  map.set(nums[i], i)
}
</code></pre>
<p>Here is the complete code for this approach:</p>
<pre><code class="lang-js"><span class="hljs-comment">/**
 * <span class="hljs-doctag">@param <span class="hljs-type">{number[]}</span> <span class="hljs-variable">nums</span></span>
 * <span class="hljs-doctag">@param <span class="hljs-type">{number}</span> <span class="hljs-variable">target</span></span>
 * <span class="hljs-doctag">@return <span class="hljs-type">{number[]}</span></span>
 */</span>
<span class="hljs-keyword">var</span> twoSum = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">nums, target</span>) </span>{
    <span class="hljs-keyword">if</span>(nums.length === <span class="hljs-number">2</span>) <span class="hljs-keyword">return</span> [<span class="hljs-number">0</span>,<span class="hljs-number">1</span>]

    <span class="hljs-keyword">const</span> map = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();

    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; nums.length; i++) {
        <span class="hljs-keyword">const</span> difference = target - nums[i]

        <span class="hljs-keyword">if</span> (map.has(difference)) {
            <span class="hljs-keyword">return</span> [map.get(difference), i]
        } <span class="hljs-keyword">else</span> {
            map.set(nums[i], i)
        }
    }

};
</code></pre>
<h3 id="heading-time-complexity-for-the-map-solution">Time Complexity for the Map Solution</h3>
<p>This solution would be a linear time complexity O(n). Since we are only using one loop instead of two, we have improved on the time complexity and no longer running in quadratic time O(n²) like we were earlier.</p>
<p>In the next few sections, we are going to start to build out the visualizations for each of these approaches. </p>
<h2 id="heading-overview-for-the-two-sum-visualization">Overview for the Two Sum Visualization</h2>
<p>The goal of this project is to create visualizations for both the map and brute force solutions. </p>
<p>For the brute force solution, we will show what is it like to walk through each pair of numbers until we find the pair that adds up to the target.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/Screenshot-2023-11-20-at-8.43.08-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Brute Force approach visualization</em></p>
<p>For the map solution, we will show the map being built out and checking for the pair that adds up to the target. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/Screenshot-2023-11-20-at-8.51.40-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Map solution visualization</em></p>
<h2 id="heading-adding-the-brute-force-visualization">Adding the Brute Force Visualization</h2>
<h3 id="heading-creating-the-const-and-let-variables">Creating the <code>const</code> and <code>let</code> Variables</h3>
<p>We first need to create <code>const</code> variables and assign them the result of accessing the HTML elements responsible for displaying the brute force solution button and output.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceSolutionBtn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"brute-force-visual-btn"</span>);
<span class="hljs-keyword">const</span> bruteForceNumbersOutput = <span class="hljs-built_in">document</span>.querySelector(
  <span class="hljs-string">"#brute-force-output &gt; .numbers-array"</span>
);
<span class="hljs-keyword">const</span> bruteForceTextOutput = <span class="hljs-built_in">document</span>.querySelector(
  <span class="hljs-string">"#brute-force-output &gt; .result-text"</span>
);
</code></pre>
<p>The next step is to create <code>const</code> variables for the test case array and target that will be used for both visualizations. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> testCaseArray = [<span class="hljs-number">11</span>, <span class="hljs-number">15</span>, <span class="hljs-number">2</span>, <span class="hljs-number">7</span>];
<span class="hljs-keyword">const</span> target = <span class="hljs-number">9</span>;
</code></pre>
<p>Then, we need to create the <code>let</code> variables that will represent the current number we are looking at in the outer loop and the compliment number we are looking at in the inner loop. </p>
<pre><code class="lang-js"><span class="hljs-keyword">let</span> currentNum;
<span class="hljs-keyword">let</span> currentCompliment;
</code></pre>
<h3 id="heading-creating-the-getclassname-function">Creating the <code>getClassName</code> Function</h3>
<p>In our visualization we want to show the user the current pair of numbers we are checking by applying different colored borders around them. The current number will have a green border around it and the current compliment number will have a blue border around it.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/Screenshot-2023-11-20-at-10.02.46-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>In order to dynamically update these styles over time, we need to create a function that will be responsible for adding the appropriate classes to the current number and it compliment. </p>
<p>First, start by creating a new <code>getClassName</code> function that takes in a <code>num</code> parameter.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> getClassName = <span class="hljs-function">(<span class="hljs-params">num</span>) =&gt;</span> {

};
</code></pre>
<p>Inside that function, create a <code>switch</code> statement that has the <code>num</code> for the expression we are checking for. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> getClassName = <span class="hljs-function">(<span class="hljs-params">num</span>) =&gt;</span> {
  <span class="hljs-keyword">switch</span> (num) {

  }
};
</code></pre>
<p>The first <code>case</code> should check for <code>currentNum</code> and return a string for the <code>current-num</code> class.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> getClassName = <span class="hljs-function">(<span class="hljs-params">num</span>) =&gt;</span> {
  <span class="hljs-keyword">switch</span> (num) {
    <span class="hljs-keyword">case</span> currentNum:
      <span class="hljs-keyword">return</span> <span class="hljs-string">"class='current-num'"</span>;
  }
};
</code></pre>
<p>The second <code>case</code> should check for the <code>currentCompliment</code> and return a string for the <code>compliment-num</code> class. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> getClassName = <span class="hljs-function">(<span class="hljs-params">num</span>) =&gt;</span> {
  <span class="hljs-keyword">switch</span> (num) {
    <span class="hljs-keyword">case</span> currentNum:
      <span class="hljs-keyword">return</span> <span class="hljs-string">"class='current-num'"</span>;
    <span class="hljs-keyword">case</span> currentCompliment:
      <span class="hljs-keyword">return</span> <span class="hljs-string">"class='compliment-num'"</span>;
  }
};
</code></pre>
<p>For the <code>default</code> case, it should return an empty string because we are not going to apply any classes for that element. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> getClassName = <span class="hljs-function">(<span class="hljs-params">num</span>) =&gt;</span> {
  <span class="hljs-keyword">switch</span> (num) {
    <span class="hljs-keyword">case</span> currentNum:
      <span class="hljs-keyword">return</span> <span class="hljs-string">"class='current-num'"</span>;
    <span class="hljs-keyword">case</span> currentCompliment:
      <span class="hljs-keyword">return</span> <span class="hljs-string">"class='compliment-num'"</span>;
    <span class="hljs-keyword">default</span>:
      <span class="hljs-keyword">return</span> <span class="hljs-string">""</span>;
  }
};
</code></pre>
<h3 id="heading-creating-the-bruteforceapproach-function">Creating the <code>bruteForceApproach</code> Function</h3>
<p>This function will be responsible for executing the brute force solution and displaying the visualization on the page. </p>
<p>We first need to create the <code>bruteForceApproach</code> function which will be an <code>async</code> function. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {

};
</code></pre>
<p>Then, we need to add the outer loop for our test case array.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {

  }
};
</code></pre>
<p>Inside the <code>for</code> loop, update the <code>currentNum</code> to assign it the value of the current number we are looking at in the test case array.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    currentNum = testCaseArray[i];
  }
};
</code></pre>
<p>Next, create the inner <code>for</code> loop.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    currentNum = testCaseArray[i];
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> j = i + <span class="hljs-number">1</span>; j &lt; testCaseArray.length; ++j) {

    }
  }
};
</code></pre>
<p>Inside the inner <code>for</code> loop, update the <code>currentCompliment</code> number and assign it the value of <code>testCaseArray[j]</code>. This is meant to represent each number to the right of the current number. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    currentNum = testCaseArray[i];
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> j = i + <span class="hljs-number">1</span>; j &lt; testCaseArray.length; ++j) {
      currentCompliment = testCaseArray[j];
    }
  }
};
</code></pre>
<p>Next, we need to add a <code>setTimeout</code> which will delay the visual changes made to the markup by one second. This is what is going to help create the animated effect of showing the different pairs of numbers. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    currentNum = testCaseArray[i];
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> j = i + <span class="hljs-number">1</span>; j &lt; testCaseArray.length; ++j) {
      currentCompliment = testCaseArray[j];
      <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">1000</span>));
    }
  }
};
</code></pre>
<p>Then we need to update the HTML for the output. Start by assigning the test case array to <code>bruteForceNumbersOutput.innerHTML</code>.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    currentNum = testCaseArray[i];
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> j = i + <span class="hljs-number">1</span>; j &lt; testCaseArray.length; ++j) {
      currentCompliment = testCaseArray[j];
      <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">1000</span>));

      bruteForceNumbersOutput.innerHTML = testCaseArray;
    }
  }
};
</code></pre>
<p>Then, we want to use the <code>map</code> method on the array, to create a new array of <code>span</code> elements which represents each number in the array along with the styles. We also need to chain the <code>join</code> method on that to remove the commas that the <code>map</code> method adds when the new array is created.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    currentNum = testCaseArray[i];
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> j = i + <span class="hljs-number">1</span>; j &lt; testCaseArray.length; ++j) {
      currentCompliment = testCaseArray[j];
      <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">1000</span>));

      bruteForceNumbersOutput.innerHTML = testCaseArray
        .map(
          <span class="hljs-function">(<span class="hljs-params">num, index</span>) =&gt;</span>
            <span class="hljs-string">`
            &lt;span <span class="hljs-subst">${getClassName(num)}</span>&gt;
            <span class="hljs-subst">${testCaseArray[index]}</span>
            &lt;/span&gt;
          `</span>
        )
        .join(<span class="hljs-string">""</span>);
    }
  }
};
</code></pre>
<p>If we don't find a pair that adds up to the target, then we want to display a message to the user. Update the text content for the <code>bruteForceTextOutput</code> and assign it the following message:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    currentNum = testCaseArray[i];
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> j = i + <span class="hljs-number">1</span>; j &lt; testCaseArray.length; ++j) {
      currentCompliment = testCaseArray[j];
      <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">1000</span>));

      bruteForceNumbersOutput.innerHTML = testCaseArray
        .map(
          <span class="hljs-function">(<span class="hljs-params">num, index</span>) =&gt;</span>
            <span class="hljs-string">`
            &lt;span <span class="hljs-subst">${getClassName(num)}</span>&gt;
            <span class="hljs-subst">${testCaseArray[index]}</span>
            &lt;/span&gt;
          `</span>
        )
        .join(<span class="hljs-string">""</span>);

      bruteForceTextOutput.textContent = <span class="hljs-string">`Does the sum of <span class="hljs-subst">${currentNum}</span> + <span class="hljs-subst">${currentCompliment}</span> equal <span class="hljs-subst">${target}</span>? NO!`</span>;
    }
  }
};
</code></pre>
<p>The last piece is to add a condition that checks if we found the pair of numbers that adds up to the target. If so, then we can display that final indices array and <code>return</code> from the function. </p>
<pre><code class="lang-js">  <span class="hljs-keyword">if</span> (currentNum + currentCompliment === target) {
      bruteForceTextOutput.textContent = <span class="hljs-string">`Final indices: [<span class="hljs-subst">${i}</span>, <span class="hljs-subst">${j}</span>]`</span>;
      <span class="hljs-keyword">return</span>;
  }
</code></pre>
<p>To test out the brute force visualization, we will need to add an event listener to the <code>bruteForceSolutionBtn</code>. The event listener should listen for a <code>"click"</code> event and should reference the <code>bruteForceApproach</code> function.</p>
<pre><code class="lang-js">bruteForceSolutionBtn.addEventListener(<span class="hljs-string">"click"</span>, bruteForceApproach);
</code></pre>
<p>This should be your complete code so far:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceSolutionBtn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"brute-force-visual-btn"</span>);
<span class="hljs-keyword">const</span> bruteForceNumbersOutput = <span class="hljs-built_in">document</span>.querySelector(
  <span class="hljs-string">"#brute-force-output &gt; .numbers-array"</span>
);
<span class="hljs-keyword">const</span> bruteForceTextOutput = <span class="hljs-built_in">document</span>.querySelector(
  <span class="hljs-string">"#brute-force-output &gt; .result-text"</span>
);
<span class="hljs-keyword">const</span> testCaseArray = [<span class="hljs-number">11</span>, <span class="hljs-number">15</span>, <span class="hljs-number">2</span>, <span class="hljs-number">7</span>];
<span class="hljs-keyword">const</span> target = <span class="hljs-number">9</span>;
<span class="hljs-keyword">let</span> currentNum;
<span class="hljs-keyword">let</span> currentCompliment;

<span class="hljs-keyword">const</span> getClassName = <span class="hljs-function">(<span class="hljs-params">num</span>) =&gt;</span> {
  <span class="hljs-keyword">switch</span> (num) {
    <span class="hljs-keyword">case</span> currentNum:
      <span class="hljs-keyword">return</span> <span class="hljs-string">"class='current-num'"</span>;
    <span class="hljs-keyword">case</span> currentCompliment:
      <span class="hljs-keyword">return</span> <span class="hljs-string">"class='compliment-num'"</span>;
    <span class="hljs-keyword">default</span>:
      <span class="hljs-keyword">return</span> <span class="hljs-string">""</span>;
  }
};

<span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    currentNum = testCaseArray[i];
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> j = i + <span class="hljs-number">1</span>; j &lt; testCaseArray.length; ++j) {
      currentCompliment = testCaseArray[j];
      <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">1000</span>));

      bruteForceNumbersOutput.innerHTML = testCaseArray
        .map(
          <span class="hljs-function">(<span class="hljs-params">num, index</span>) =&gt;</span>
            <span class="hljs-string">`
            &lt;span <span class="hljs-subst">${getClassName(num)}</span>&gt;
            <span class="hljs-subst">${testCaseArray[index]}</span>
            &lt;/span&gt;
          `</span>
        )
        .join(<span class="hljs-string">""</span>);

      bruteForceTextOutput.textContent = <span class="hljs-string">`Does the sum of <span class="hljs-subst">${currentNum}</span> + <span class="hljs-subst">${currentCompliment}</span> equal <span class="hljs-subst">${target}</span>? NO!`</span>;

      <span class="hljs-keyword">if</span> (currentNum + currentCompliment === target) {
        bruteForceTextOutput.textContent = <span class="hljs-string">`Final indices: [<span class="hljs-subst">${i}</span>, <span class="hljs-subst">${j}</span>]`</span>;
        <span class="hljs-keyword">return</span>;
      }
    }
  }
};

bruteForceSolutionBtn.addEventListener(<span class="hljs-string">"click"</span>, bruteForceApproach);
</code></pre>
<p>Try out your visualization by clicking on the "Show Visualization" button for the Brute force approach. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/Screenshot-2023-11-20-at-10.42.51-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Result of clicking the "show visualization" button for brute force approach</em></p>
<h2 id="heading-how-to-disable-the-bruteforcesolutionbtn-when-the-animation-is-in-progress">How to Disable the <code>bruteForceSolutionBtn</code> When the Animation is in Progress</h2>
<p>If you try to click on the <code>bruteForceSolutionBtn</code> multiple times in a row, you will see glitches in the animation. To fix that, we should disable the button when the animation is running and then re-enable it when the animation is complete. </p>
<p>Inside the <code>bruteForceApproach</code> function, set the disabled attribute for the <code>bruteForceSolutionBtn</code>. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  bruteForceSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
</code></pre>
<p>Inside the <code>if</code> statement, remove the disabled attribute for the <code>bruteForceSolutionBtn</code>.</p>
<pre><code class="lang-js">   <span class="hljs-keyword">if</span> (currentNum + currentCompliment === target) {
        bruteForceTextOutput.textContent = <span class="hljs-string">`Final indices: [<span class="hljs-subst">${i}</span>, <span class="hljs-subst">${j}</span>]`</span>;
        bruteForceSolutionBtn.removeAttribute(<span class="hljs-string">"disabled"</span>);
        <span class="hljs-keyword">return</span>;
   }
</code></pre>
<p>Here is the complete code with the fix:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceSolutionBtn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"brute-force-visual-btn"</span>);
<span class="hljs-keyword">const</span> bruteForceNumbersOutput = <span class="hljs-built_in">document</span>.querySelector(
  <span class="hljs-string">"#brute-force-output &gt; .numbers-array"</span>
);
<span class="hljs-keyword">const</span> bruteForceTextOutput = <span class="hljs-built_in">document</span>.querySelector(
  <span class="hljs-string">"#brute-force-output &gt; .result-text"</span>
);
<span class="hljs-keyword">const</span> testCaseArray = [<span class="hljs-number">11</span>, <span class="hljs-number">15</span>, <span class="hljs-number">2</span>, <span class="hljs-number">7</span>];
<span class="hljs-keyword">const</span> target = <span class="hljs-number">9</span>;
<span class="hljs-keyword">let</span> currentNum;
<span class="hljs-keyword">let</span> currentCompliment;

<span class="hljs-keyword">const</span> getClassName = <span class="hljs-function">(<span class="hljs-params">num</span>) =&gt;</span> {
  <span class="hljs-keyword">switch</span> (num) {
    <span class="hljs-keyword">case</span> currentNum:
      <span class="hljs-keyword">return</span> <span class="hljs-string">"class='current-num'"</span>;
    <span class="hljs-keyword">case</span> currentCompliment:
      <span class="hljs-keyword">return</span> <span class="hljs-string">"class='compliment-num'"</span>;
    <span class="hljs-keyword">default</span>:
      <span class="hljs-keyword">return</span> <span class="hljs-string">""</span>;
  }
};

<span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  bruteForceSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);

  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    currentNum = testCaseArray[i];
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> j = i + <span class="hljs-number">1</span>; j &lt; testCaseArray.length; ++j) {
      currentCompliment = testCaseArray[j];
      <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">1000</span>));

      bruteForceNumbersOutput.innerHTML = testCaseArray
        .map(
          <span class="hljs-function">(<span class="hljs-params">num, index</span>) =&gt;</span>
            <span class="hljs-string">`
            &lt;span <span class="hljs-subst">${getClassName(num)}</span>&gt;
            <span class="hljs-subst">${testCaseArray[index]}</span>
            &lt;/span&gt;
          `</span>
        )
        .join(<span class="hljs-string">""</span>);

      bruteForceTextOutput.textContent = <span class="hljs-string">`Does the sum of <span class="hljs-subst">${currentNum}</span> + <span class="hljs-subst">${currentCompliment}</span> equal <span class="hljs-subst">${target}</span>? NO!`</span>;

      <span class="hljs-keyword">if</span> (currentNum + currentCompliment === target) {
        bruteForceTextOutput.textContent = <span class="hljs-string">`Final indices: [<span class="hljs-subst">${i}</span>, <span class="hljs-subst">${j}</span>]`</span>;
        bruteForceSolutionBtn.removeAttribute(<span class="hljs-string">"disabled"</span>);
        <span class="hljs-keyword">return</span>;
      }
    }
  }
};

bruteForceSolutionBtn.addEventListener(<span class="hljs-string">"click"</span>, bruteForceApproach);
</code></pre>
<p>Try out the visualization again, and now you should see that the button is disabled when the animation is running.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/Screenshot-2023-11-20-at-10.56.36-AM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Image showing how button is disabled when animation is showing</em></p>
<h2 id="heading-adding-the-map-solution-visualization">Adding the Map Solution Visualization</h2>
<h3 id="heading-creating-the-const-variables">Creating the <code>const</code> Variables</h3>
<p>We are going to create some new <code>const</code> variables which represent the optimal solution button element, output, and table elements for the animation.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalSolutionBtn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"optimal-visual-btn"</span>);
<span class="hljs-keyword">const</span> currentValueOutput = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"current-value-output"</span>);
<span class="hljs-keyword">const</span> finalOptimalSolutionResult = <span class="hljs-built_in">document</span>.getElementById(
  <span class="hljs-string">"final-optimal-result"</span>
);
<span class="hljs-keyword">const</span> table = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"table-output"</span>);
<span class="hljs-keyword">const</span> tableBodyOutput = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"map-table-body"</span>);
</code></pre>
<p>Here is the complete list of variable declarations for both visualizations:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceSolutionBtn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"brute-force-visual-btn"</span>);
<span class="hljs-keyword">const</span> bruteForceNumbersOutput = <span class="hljs-built_in">document</span>.querySelector(
  <span class="hljs-string">"#brute-force-output &gt; .numbers-array"</span>
);
<span class="hljs-keyword">const</span> bruteForceTextOutput = <span class="hljs-built_in">document</span>.querySelector(
  <span class="hljs-string">"#brute-force-output &gt; .result-text"</span>
);
<span class="hljs-keyword">const</span> optimalSolutionBtn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"optimal-visual-btn"</span>);
<span class="hljs-keyword">const</span> currentValueOutput = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"current-value-output"</span>);
<span class="hljs-keyword">const</span> finalOptimalSolutionResult = <span class="hljs-built_in">document</span>.getElementById(
  <span class="hljs-string">"final-optimal-result"</span>
);
<span class="hljs-keyword">const</span> table = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"table-output"</span>);
<span class="hljs-keyword">const</span> tableBodyOutput = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"map-table-body"</span>);

<span class="hljs-keyword">const</span> testCaseArray = [<span class="hljs-number">11</span>, <span class="hljs-number">15</span>, <span class="hljs-number">2</span>, <span class="hljs-number">7</span>];
<span class="hljs-keyword">const</span> target = <span class="hljs-number">9</span>;
<span class="hljs-keyword">let</span> currentNum;
<span class="hljs-keyword">let</span> currentCompliment;
</code></pre>
<h3 id="heading-creating-the-optimalapproach-async-function">Creating the <code>optimalApproach</code> Async Function</h3>
<p>The first step is to create the new <code>optimalApproach</code> function which will be an <code>async</code> function. You can add this below your <code>bruteForceApproach</code> function.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {

};
</code></pre>
<p>Just like the <code>bruteForceApproach</code> function, we want to disable the button when the animation starts to prevent users from clicking it multiple times and breaking the animation.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
  optimalSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
};
</code></pre>
<p>When the page first loads, the table is hidden by default. We want to show the table element when the animation starts.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
  optimalSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
  table.style.display = <span class="hljs-string">"block"</span>;
};
</code></pre>
<p>Each time we run this animation, we want to display messages to the user on if we have found the correct pair or not. At the beginning of the animation, we want to clear the previous output. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
  optimalSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
  table.style.display = <span class="hljs-string">"block"</span>;
  currentValueOutput.innerHTML = <span class="hljs-string">""</span>;
};
</code></pre>
<p>Then, we need to create an empty <code>map</code> object which will eventually be updated over time in the <code>for</code> loop.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
  optimalSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
  table.style.display = <span class="hljs-string">"block"</span>;
  currentValueOutput.innerHTML = <span class="hljs-string">""</span>;
  <span class="hljs-keyword">const</span> map = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();
};
</code></pre>
<p>Next, we need to create a <code>for</code> loop which will be responsible for looping through each number in the array and updating the animation overtime. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
  optimalSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
  table.style.display = <span class="hljs-string">"block"</span>;
  currentValueOutput.innerHTML = <span class="hljs-string">""</span>;
  <span class="hljs-keyword">const</span> map = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();

  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {

  }
};
</code></pre>
<p>Inside the loop, we need to add the expression for calculating the difference.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
  optimalSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
  table.style.display = <span class="hljs-string">"block"</span>;
  currentValueOutput.innerHTML = <span class="hljs-string">""</span>;
  <span class="hljs-keyword">const</span> map = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();

  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    <span class="hljs-keyword">const</span> difference = target - testCaseArray[i];
  }
};
</code></pre>
<p>Then, we need to add a <code>setTimeout</code> which will delay the changes by 2 seconds in the HTML markup and help with the animation effect.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
  optimalSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
  table.style.display = <span class="hljs-string">"block"</span>;
  currentValueOutput.innerHTML = <span class="hljs-string">""</span>;
  <span class="hljs-keyword">const</span> map = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();

  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    <span class="hljs-keyword">const</span> difference = target - testCaseArray[i];

    <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">2000</span>));
  }
};
</code></pre>
<p>We then need to add an <code>if</code> statement to check if the map has the difference value.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
  optimalSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
  table.style.display = <span class="hljs-string">"block"</span>;
  currentValueOutput.innerHTML = <span class="hljs-string">""</span>;
  <span class="hljs-keyword">const</span> map = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();

  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    <span class="hljs-keyword">const</span> difference = target - testCaseArray[i];

    <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">2000</span>));

    <span class="hljs-keyword">if</span> (map.has(difference)) {

    }
  }
};
</code></pre>
<p>Inside the <code>if</code> statement, we need to update the text content to show the final indices array result on the screen. We will use the <code>get</code> method to get the index value from the <code>map</code>. </p>
<pre><code class="lang-js"> <span class="hljs-keyword">if</span> (map.has(difference)) {
      finalOptimalSolutionResult.textContent = <span class="hljs-string">`Final indices: [<span class="hljs-subst">${map.get(
        difference
      )}</span>, <span class="hljs-subst">${i}</span>]`</span>;
 }
</code></pre>
<p>We also need to update the output for displaying a message that shows we have found the pair of numbers that adds up to the target. </p>
<pre><code class="lang-js">  <span class="hljs-keyword">if</span> (map.has(difference)) {
      finalOptimalSolutionResult.textContent = <span class="hljs-string">`Final indices: [<span class="hljs-subst">${map.get(
        difference
      )}</span>, <span class="hljs-subst">${i}</span>]`</span>;
      currentValueOutput.innerHTML = <span class="hljs-string">`
      &lt;p&gt;Difference(<span class="hljs-subst">${difference}</span>) = target(<span class="hljs-subst">${target}</span>) - current number(<span class="hljs-subst">${testCaseArray[i]}</span>)&lt;/p&gt;
      &lt;p&gt;Is the difference(<span class="hljs-subst">${difference}</span>) in our map? YES, we found that pair of numbers that add up to the target.&lt;/p&gt;
    `</span>;
  }
</code></pre>
<p>We also need to remove the disabled attribute from the <code>optimalSolutionBtn</code> and return from the function. </p>
<pre><code class="lang-js">  <span class="hljs-keyword">if</span> (map.has(difference)) {
      finalOptimalSolutionResult.textContent = <span class="hljs-string">`Final indices: [<span class="hljs-subst">${map.get(
        difference
      )}</span>, <span class="hljs-subst">${i}</span>]`</span>;
      currentValueOutput.innerHTML = <span class="hljs-string">`
      &lt;p&gt;Difference(<span class="hljs-subst">${difference}</span>) = target(<span class="hljs-subst">${target}</span>) - current number(<span class="hljs-subst">${testCaseArray[i]}</span>)&lt;/p&gt;
      &lt;p&gt;Is the difference(<span class="hljs-subst">${difference}</span>) in our map? YES, we found that pair of numbers that add up to the target.&lt;/p&gt;
    `</span>;
      optimalSolutionBtn.removeAttribute(<span class="hljs-string">"disabled"</span>);
      <span class="hljs-keyword">return</span>;
  }
</code></pre>
<p>If the pair has not been found, then we need to add an <code>else</code> clause.</p>
<pre><code class="lang-js">  <span class="hljs-keyword">if</span> (map.has(difference)) {
      finalOptimalSolutionResult.textContent = <span class="hljs-string">`Final indices: [<span class="hljs-subst">${map.get(
        difference
      )}</span>, <span class="hljs-subst">${i}</span>]`</span>;
      currentValueOutput.innerHTML = <span class="hljs-string">`
      &lt;p&gt;Difference(<span class="hljs-subst">${difference}</span>) = target(<span class="hljs-subst">${target}</span>) - current number(<span class="hljs-subst">${testCaseArray[i]}</span>)&lt;/p&gt;
      &lt;p&gt;Is the difference(<span class="hljs-subst">${difference}</span>) in our map? YES, we found that pair of numbers that add up to the target.&lt;/p&gt;
    `</span>;
      optimalSolutionBtn.removeAttribute(<span class="hljs-string">"disabled"</span>);
      <span class="hljs-keyword">return</span>;
  } <span class="hljs-keyword">else</span> {

  }
</code></pre>
<p>Inside the <code>else</code> clause, we need to update the message to show that we have not found the pair and that the current number <code>testCaseArray[i]</code> is going to be added to the <code>map</code> along with its index value.</p>
<pre><code class="lang-js"><span class="hljs-keyword">else</span> {
      currentValueOutput.innerHTML = <span class="hljs-string">`
        &lt;p&gt;Difference(<span class="hljs-subst">${difference}</span>) = target(<span class="hljs-subst">${target}</span>) - current number(<span class="hljs-subst">${testCaseArray[i]}</span>)&lt;/p&gt;
        &lt;p&gt;Is the difference(<span class="hljs-subst">${difference}</span>) in our map? No.&lt;/p&gt;
        &lt;p&gt;Add the current number <span class="hljs-subst">${testCaseArray[i]}</span> to our map.&lt;/p&gt;
      `</span>;
}
</code></pre>
<p>We then need to update the table output with the current number and its index value.</p>
<pre><code class="lang-js"><span class="hljs-keyword">else</span> {
      currentValueOutput.innerHTML = <span class="hljs-string">`
        &lt;p&gt;Difference(<span class="hljs-subst">${difference}</span>) = target(<span class="hljs-subst">${target}</span>) - current number(<span class="hljs-subst">${testCaseArray[i]}</span>)&lt;/p&gt;
        &lt;p&gt;Is the difference(<span class="hljs-subst">${difference}</span>) in our map? No.&lt;/p&gt;
        &lt;p&gt;Add the current number <span class="hljs-subst">${testCaseArray[i]}</span> to our map.&lt;/p&gt;
      `</span>;
      tableBodyOutput.innerHTML += <span class="hljs-string">`
      &lt;tr&gt;
        &lt;td&gt;<span class="hljs-subst">${testCaseArray[i]}</span>&lt;/td&gt;
        &lt;td&gt;<span class="hljs-subst">${i}</span>&lt;/td&gt;
      &lt;/tr&gt;
    `</span>;
}
</code></pre>
<p>Lastly, use the <code>set</code> method to set the current number and index value in the <code>map</code>.</p>
<pre><code class="lang-js"><span class="hljs-keyword">else</span> {
      currentValueOutput.innerHTML = <span class="hljs-string">`
        &lt;p&gt;Difference(<span class="hljs-subst">${difference}</span>) = target(<span class="hljs-subst">${target}</span>) - current number(<span class="hljs-subst">${testCaseArray[i]}</span>)&lt;/p&gt;
        &lt;p&gt;Is the difference(<span class="hljs-subst">${difference}</span>) in our map? No.&lt;/p&gt;
        &lt;p&gt;Add the current number <span class="hljs-subst">${testCaseArray[i]}</span> to our map.&lt;/p&gt;
      `</span>;
      tableBodyOutput.innerHTML += <span class="hljs-string">`
      &lt;tr&gt;
        &lt;td&gt;<span class="hljs-subst">${testCaseArray[i]}</span>&lt;/td&gt;
        &lt;td&gt;<span class="hljs-subst">${i}</span>&lt;/td&gt;
      &lt;/tr&gt;
    `</span>;
      map.set(testCaseArray[i], i);
}
</code></pre>
<p>Here is the complete code for your <code>optimalApproach</code> function.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
  optimalSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
  table.style.display = <span class="hljs-string">"block"</span>;
  currentValueOutput.innerHTML = <span class="hljs-string">""</span>;
  <span class="hljs-keyword">const</span> map = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();

  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    <span class="hljs-keyword">const</span> difference = target - testCaseArray[i];

    <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">2000</span>));

    <span class="hljs-keyword">if</span> (map.has(difference)) {
      finalOptimalSolutionResult.textContent = <span class="hljs-string">`Final indices: [<span class="hljs-subst">${map.get(
        difference
      )}</span>, <span class="hljs-subst">${i}</span>]`</span>;
      currentValueOutput.innerHTML = <span class="hljs-string">`
      &lt;p&gt;Difference(<span class="hljs-subst">${difference}</span>) = target(<span class="hljs-subst">${target}</span>) - current number(<span class="hljs-subst">${testCaseArray[i]}</span>)&lt;/p&gt;
      &lt;p&gt;Is the difference(<span class="hljs-subst">${difference}</span>) in our map? YES, we found that pair of numbers that add up to the target.&lt;/p&gt;
    `</span>;
      optimalSolutionBtn.removeAttribute(<span class="hljs-string">"disabled"</span>);
      <span class="hljs-keyword">return</span>;
    } <span class="hljs-keyword">else</span> {
      currentValueOutput.innerHTML = <span class="hljs-string">`
        &lt;p&gt;Difference(<span class="hljs-subst">${difference}</span>) = target(<span class="hljs-subst">${target}</span>) - current number(<span class="hljs-subst">${testCaseArray[i]}</span>)&lt;/p&gt;
        &lt;p&gt;Is the difference(<span class="hljs-subst">${difference}</span>) in our map? No.&lt;/p&gt;
        &lt;p&gt;Add the current number <span class="hljs-subst">${testCaseArray[i]}</span> to our map.&lt;/p&gt;
      `</span>;
      tableBodyOutput.innerHTML += <span class="hljs-string">`
      &lt;tr&gt;
        &lt;td&gt;<span class="hljs-subst">${testCaseArray[i]}</span>&lt;/td&gt;
        &lt;td&gt;<span class="hljs-subst">${i}</span>&lt;/td&gt;
      &lt;/tr&gt;
    `</span>;
      map.set(testCaseArray[i], i);
    }
  }
};
</code></pre>
<p>To test out this visualization, add an event listener to the <code>optimalSolutionBtn</code> and pass in the <code>"click"</code> event and <code>optimalApproach</code> function reference. </p>
<pre><code class="lang-js">optimalSolutionBtn.addEventListener(<span class="hljs-string">"click"</span>, optimalApproach);
</code></pre>
<p>When you click on the "Show Visualization" button for the map solution, you should see the animation, as shown below:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/Screenshot-2023-11-20-at-12.05.05-PM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Visualization for map solution</em></p>
<h2 id="heading-how-to-reset-the-table-output-for-the-map-solution">How to Reset the Table Output for the Map Solution</h2>
<p>If you try to run the animation multiple times, then you will see that the table shows the results from the previous run.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/Screenshot-2023-11-20-at-12.09.35-PM.png" alt="Image" width="600" height="400" loading="lazy">
<em>Table showing results from the previous run</em></p>
<p>To fix this, we can reset the table before each run of the animation. Start by creating a <code>resetTable</code> function above your <code>optimalApproach</code> function.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> resetTable = <span class="hljs-function">() =&gt;</span> {

};

<span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
    .........
</code></pre>
<p>Inside that function, clear out the table and final text results. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> resetTable = <span class="hljs-function">() =&gt;</span> {
  tableBodyOutput.innerHTML = <span class="hljs-string">""</span>;
  finalOptimalSolutionResult.textContent = <span class="hljs-string">""</span>;
};
</code></pre>
<p>Call the <code>resetTable</code> function inside your <code>optimalApproach</code> function in order to see the results of resetting the table.</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
  resetTable();
  optimalSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
    ...........
</code></pre>
<p>Test out your animation again, and now you should see that the table results reset before each new animation run. </p>
<h2 id="heading-final-solution-code-and-live-example">Final Solution Code and Live Example</h2>
<p>Here is the complete JavaScript solution code for both visualizations:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> bruteForceSolutionBtn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"brute-force-visual-btn"</span>);
<span class="hljs-keyword">const</span> bruteForceNumbersOutput = <span class="hljs-built_in">document</span>.querySelector(
  <span class="hljs-string">"#brute-force-output &gt; .numbers-array"</span>
);
<span class="hljs-keyword">const</span> bruteForceTextOutput = <span class="hljs-built_in">document</span>.querySelector(
  <span class="hljs-string">"#brute-force-output &gt; .result-text"</span>
);
<span class="hljs-keyword">const</span> optimalSolutionBtn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"optimal-visual-btn"</span>);
<span class="hljs-keyword">const</span> currentValueOutput = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"current-value-output"</span>);
<span class="hljs-keyword">const</span> finalOptimalSolutionResult = <span class="hljs-built_in">document</span>.getElementById(
  <span class="hljs-string">"final-optimal-result"</span>
);
<span class="hljs-keyword">const</span> table = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"table-output"</span>);
<span class="hljs-keyword">const</span> tableBodyOutput = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"map-table-body"</span>);

<span class="hljs-keyword">const</span> testCaseArray = [<span class="hljs-number">11</span>, <span class="hljs-number">15</span>, <span class="hljs-number">2</span>, <span class="hljs-number">7</span>];
<span class="hljs-keyword">const</span> target = <span class="hljs-number">9</span>;
<span class="hljs-keyword">let</span> currentNum;
<span class="hljs-keyword">let</span> currentCompliment;

<span class="hljs-keyword">const</span> getClassName = <span class="hljs-function">(<span class="hljs-params">num</span>) =&gt;</span> {
  <span class="hljs-keyword">switch</span> (num) {
    <span class="hljs-keyword">case</span> currentNum:
      <span class="hljs-keyword">return</span> <span class="hljs-string">"class='current-num'"</span>;
    <span class="hljs-keyword">case</span> currentCompliment:
      <span class="hljs-keyword">return</span> <span class="hljs-string">"class='compliment-num'"</span>;
    <span class="hljs-keyword">default</span>:
      <span class="hljs-keyword">return</span> <span class="hljs-string">""</span>;
  }
};

<span class="hljs-keyword">const</span> bruteForceApproach = <span class="hljs-keyword">async</span> () =&gt; {
  bruteForceSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);

  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    currentNum = testCaseArray[i];
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> j = i + <span class="hljs-number">1</span>; j &lt; testCaseArray.length; ++j) {
      currentCompliment = testCaseArray[j];
      <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">1000</span>));

      bruteForceNumbersOutput.innerHTML = testCaseArray
        .map(
          <span class="hljs-function">(<span class="hljs-params">num, index</span>) =&gt;</span>
            <span class="hljs-string">`
              &lt;span <span class="hljs-subst">${getClassName(num)}</span>&gt;
              <span class="hljs-subst">${testCaseArray[index]}</span>
              &lt;/span&gt;
            `</span>
        )
        .join(<span class="hljs-string">""</span>);

      bruteForceTextOutput.textContent = <span class="hljs-string">`Does the sum of <span class="hljs-subst">${currentNum}</span> + <span class="hljs-subst">${currentCompliment}</span> equal <span class="hljs-subst">${target}</span>? NO!`</span>;

      <span class="hljs-keyword">if</span> (currentNum + currentCompliment === target) {
        bruteForceTextOutput.textContent = <span class="hljs-string">`Final indices: [<span class="hljs-subst">${i}</span>, <span class="hljs-subst">${j}</span>]`</span>;
        bruteForceSolutionBtn.removeAttribute(<span class="hljs-string">"disabled"</span>);
        <span class="hljs-keyword">return</span>;
      }
    }
  }
};

<span class="hljs-keyword">const</span> resetTable = <span class="hljs-function">() =&gt;</span> {
  tableBodyOutput.innerHTML = <span class="hljs-string">""</span>;
  finalOptimalSolutionResult.textContent = <span class="hljs-string">""</span>;
};

<span class="hljs-keyword">const</span> optimalApproach = <span class="hljs-keyword">async</span> () =&gt; {
  resetTable();
  optimalSolutionBtn.setAttribute(<span class="hljs-string">"disabled"</span>, <span class="hljs-string">""</span>);
  table.style.display = <span class="hljs-string">"block"</span>;
  currentValueOutput.innerHTML = <span class="hljs-string">""</span>;
  <span class="hljs-keyword">const</span> map = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();

  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; testCaseArray.length; ++i) {
    <span class="hljs-keyword">const</span> difference = target - testCaseArray[i];

    <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">2000</span>));

    <span class="hljs-keyword">if</span> (map.has(difference)) {
      finalOptimalSolutionResult.textContent = <span class="hljs-string">`Final indices: [<span class="hljs-subst">${map.get(
        difference
      )}</span>, <span class="hljs-subst">${i}</span>]`</span>;
      currentValueOutput.innerHTML = <span class="hljs-string">`
      &lt;p&gt;Difference(<span class="hljs-subst">${difference}</span>) = target(<span class="hljs-subst">${target}</span>) - current number(<span class="hljs-subst">${testCaseArray[i]}</span>)&lt;/p&gt;
      &lt;p&gt;Is the difference(<span class="hljs-subst">${difference}</span>) in our map? YES, we found that pair of numbers that add up to the target.&lt;/p&gt;
    `</span>;
      optimalSolutionBtn.removeAttribute(<span class="hljs-string">"disabled"</span>);
      <span class="hljs-keyword">return</span>;
    } <span class="hljs-keyword">else</span> {
      currentValueOutput.innerHTML = <span class="hljs-string">`
        &lt;p&gt;Difference(<span class="hljs-subst">${difference}</span>) = target(<span class="hljs-subst">${target}</span>) - current number(<span class="hljs-subst">${testCaseArray[i]}</span>)&lt;/p&gt;
        &lt;p&gt;Is the difference(<span class="hljs-subst">${difference}</span>) in our map? No.&lt;/p&gt;
        &lt;p&gt;Add the current number <span class="hljs-subst">${testCaseArray[i]}</span> to our map.&lt;/p&gt;
      `</span>;
      tableBodyOutput.innerHTML += <span class="hljs-string">`
        &lt;tr&gt;
          &lt;td&gt;<span class="hljs-subst">${testCaseArray[i]}</span>&lt;/td&gt;
          &lt;td&gt;<span class="hljs-subst">${i}</span>&lt;/td&gt;
        &lt;/tr&gt;
      `</span>;
      map.set(testCaseArray[i], i);
    }
  }
};

bruteForceSolutionBtn.addEventListener(<span class="hljs-string">"click"</span>, bruteForceApproach);
optimalSolutionBtn.addEventListener(<span class="hljs-string">"click"</span>, optimalApproach);
</code></pre>
<p>Here is a <a target="_blank" href="https://codepen.io/Jessica-Wilkins-the-decoder/full/eYxVyKN">link</a> again to the final live result on CodePen.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>I hope you enjoyed that project and learned a little bit more about how the Two Sum problem works. </p>
<p>I encourage you to play around with the project and maybe add some new features on your own like testing out different numbers or asking for user inputs for the numbers array and targets. 👍🏾</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Learn CSS – Responsive Web Design Study Guide ]]>
                </title>
                <description>
                    <![CDATA[ Cascading Style Sheets (CSS) represents the design for a web page. But when you are learning this information for the first time, it can be hard to keep track of all of the different CSS properties. In this article, I have created a study guide for t... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/learn-css/</link>
                <guid isPermaLink="false">66b8d9f16b74ac70ba21e6c7</guid>
                
                    <category>
                        <![CDATA[ CSS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ freeCodeCamp.org ]]>
                    </category>
                
                    <category>
                        <![CDATA[ HTML ]]>
                    </category>
                
                    <category>
                        <![CDATA[ responsive design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Mon, 07 Nov 2022 18:24:20 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/07/kobu-agency-ipARHaxETRk-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Cascading Style Sheets (CSS) represents the design for a web page. But when you are learning this information for the first time, it can be hard to keep track of all of the different CSS properties.</p>
<p>In this article, I have created a study guide for the freeCodeCamp curriculum's entire <a target="_blank" href="https://www.freecodecamp.org/learn/2022/responsive-web-design/#learn-basic-css-by-building-a-cafe-menu">Learn Basic CSS by Building a Cafe Menu practice project</a>. This study guide is filled with additional information, articles, and videos to help you understand the concepts better.</p>
<p>Feel free to reference this guide as you go through the certification. The first part of the project reviews HTML elements and then moves onto CSS. </p>
<p>Here is the complete list of topics covered. Click on any of the links below to learn more about the topic.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><a class="post-section-overview" href="#heading-doctype-and-html-elements">DOCTYPE and HTML elements</a> - Step 1</li>
<li><a class="post-section-overview" href="#heading-head-and-title-elements">Head and Title elements</a> - Step 2</li>
<li><a class="post-section-overview" href="#heading-meta-charset-attribute">Meta charset attribute</a> - Steps 3,17</li>
<li><a class="post-section-overview" href="#heading-body-element">Body element</a> - Step 4</li>
<li><a class="post-section-overview" href="#heading-heading-elements">Heading elements</a> - Steps 6,9,10, 47</li>
<li><a class="post-section-overview" href="#heading-paragraph-element">Paragraph element</a> - Steps 7, 30, 31, 49, 65</li>
<li><a class="post-section-overview" href="#heading-header-element">Header element</a> - Step 7</li>
<li><a class="post-section-overview" href="#heading-main-element">Main element</a> - Step 5 </li>
<li><a class="post-section-overview" href="#heading-section-elements">Section Elements</a> - Steps 8, 9, 46</li>
<li><a class="post-section-overview" href="#heading-style-element">Style element</a> - Step 10</li>
<li><a class="post-section-overview" href="#heading-text-align-property-in-css">text-align property in CSS</a> - Steps 11, 12,  33,  35</li>
<li><a class="post-section-overview" href="#heading-grouping-css-selectors">Grouping CSS selectors</a> - Steps 13, 51</li>
<li><a class="post-section-overview" href="#heading-linking-external-stylesheets">Linking External Stylesheets</a> - Step 16</li>
<li><a class="post-section-overview" href="#heading-viewport-meta-tag">Viewport meta tag</a> - Step 18</li>
<li><a class="post-section-overview" href="#heading-background-color-property">background-color property</a> - Steps 18, 19, 23, 68</li>
<li><a class="post-section-overview" href="#heading-div-element">Div element</a> - Step 20</li>
<li><a class="post-section-overview" href="#heading-css-width-property">CSS <code>width</code> property</a> - Steps 21, 24, 38, 39, 41, 45</li>
<li><a class="post-section-overview" href="#heading-css-comments">CSS comments</a> - Steps 22, 77</li>
<li><a class="post-section-overview" href="#heading-margin-property">Margin property</a> - Steps 25, 73, 75, 84, 85, 86, 91</li>
<li><a class="post-section-overview" href="#heading-class-selectors">Class selectors</a> - Steps 26, 27, 32,  34, 36, 42, 44, 50, 61, 76, 87</li>
<li><a class="post-section-overview" href="#heading-background-image-property"><code>background-image</code> property</a> - Step 28</li>
<li><a class="post-section-overview" href="#heading-article-element">Article element</a> - Steps 29, 31, 48, 52</li>
<li><a class="post-section-overview" href="#heading-block-inline-and-inline-block-values">Block, inline and inline-block values</a> - Steps 37, 89</li>
<li><a class="post-section-overview" href="#heading-padding">Padding</a> - Steps 53 - 55, 72</li>
<li><a class="post-section-overview" href="#heading-max-width-property"><code>max-width</code> property</a> - Step 56</li>
<li><a class="post-section-overview" href="#heading-font-family-property">font-family</a> - Step 57 - 59</li>
<li><a class="post-section-overview" href="#heading-font-style-property"><code>font-style</code> property</a> - Step 60</li>
<li><a class="post-section-overview" href="#heading-font-size-property"><code>font-size</code> property</a> - Steps 62, 74, 78</li>
<li><a class="post-section-overview" href="#heading-footer-elements">Footer elements</a> - Step 63</li>
<li><a class="post-section-overview" href="#heading-anchor-elements">Anchor elements</a> - Step 64</li>
<li><a class="post-section-overview" href="#heading-hr-element">hr element</a> - Steps 66, 71</li>
<li><a class="post-section-overview" href="#heading-height-property">Height property</a> - Steps 67, 70</li>
<li><a class="post-section-overview" href="#heading-border-color-property"><code>border-color</code> property</a> - Step 69</li>
<li><a class="post-section-overview" href="#heading-color-property">Color property</a> - Steps 79, 83</li>
<li><a class="post-section-overview" href="#heading-pseudo-classes">Pseudo-classes</a> - Steps 80, 81, 82</li>
<li><a class="post-section-overview" href="#heading-image-elements">Image elements</a> - Steps 88, 90</li>
<li><a class="post-section-overview" href="#heading-additional-resources-for-html-and-css">Additional resources for HTML and CSS</a></li>
</ul>
<h2 id="heading-doctype-and-html-elements">DOCTYPE and HTML elements</h2>
<p>The first line in your HTML code should be the <code>DOCTYPE</code> declaration. A <code>DOCTYPE</code> tells the browser what version of HTML the page is written in.</p>
<p>This is the <code>DOCTYPE</code> declaration for HTML 5:</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
</code></pre>
<p>If you forget to include this line of code in your file, then some of the HTML 5 tags like <code>&lt;article&gt;</code>, <code>&lt;footer&gt;</code>, and <code>&lt;header&gt;</code>  may not be supported by the browser.</p>
<p>The <code>html</code> element is the root element where all other elements go inside of it. </p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
  <span class="hljs-comment">&lt;!--All other elements go inside here--&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>The <code>lang</code> attribute inside the opening <code>&lt;html&gt;</code> tag sets the language for the page. It is also good to include it for accessibility reasons, because screen readers will know how to properly pronounce the text.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
</code></pre>
<h2 id="heading-head-and-title-elements">Head and Title elements</h2>
<p>The <code>&lt;head&gt;</code> tags contain information that is processed by machines. Inside the <code>&lt;head&gt;</code> tags, you will nest metadata which is data that describes the document to the machine.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-comment">&lt;!--important meta data goes inside here--&gt;</span>
  <span class="hljs-comment">&lt;!--title element also goes inside here--&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
</code></pre>
<p>The <code>&lt;title&gt;</code> tag is the title for the web page. This text is shown in the browser's title bar.</p>
<pre><code class="lang-html">    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>HTML 5 Boilerplate<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/07/Screen-Shot-2021-07-30-at-4.15.25-AM.png" alt="Screen-Shot-2021-07-30-at-4.15.25-AM" width="600" height="400" loading="lazy"></p>
<p>This is an example of what a <code>head</code> would look like on a real web page. None of this information is displayed on the web page itself.</p>
<pre><code class="lang-html"> <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">http-equiv</span>=<span class="hljs-string">"X-UA-Compatible"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"ie=edge"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>HTML 5 Boilerplate<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"stylesheet"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"style.css"</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
</code></pre>
<p>For a detailed description of each meta tag listed, you can read through <a target="_blank" href="https://www.freecodecamp.org/news/basic-html5-template-boilerplate-code-example/">this article on an HTML5 Boilerplate</a>.</p>
<h2 id="heading-meta-charset-attribute">Meta charset attribute</h2>
<p>UTF-8 is the standard character encoding you should use in your web pages. This will usually be the first <code>&lt;meta&gt;</code> tag shown in the <code>&lt;head&gt;</code> element.</p>
<pre><code class="lang-html"> <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span>&gt;</span>
</code></pre>
<p>According to the <a target="_blank" href="https://www.w3.org/International/questions/qa-choosing-encodings">World Wide Web Consortium</a>,</p>
<blockquote>
<p>A Unicode-based encoding such as UTF-8 can support many languages and can accommodate pages and forms in any mixture of those languages. Its use also eliminates the need for server-side logic to individually determine the character encoding for each page served or each incoming form submission.</p>
</blockquote>
<h2 id="heading-body-element">Body element</h2>
<p>The body element contains all of the content for the web page. This includes headings, paragraphs, images, links, and more.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">html</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Let's learn about the body element<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-comment">&lt;!--web page content goes inside here--&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<h2 id="heading-heading-elements">Heading elements</h2>
<p>HTML heading elements represent the main heading and subheadings of a web page.</p>
<p>The <code>h1</code> element represents the most important heading and should only be used once per web page.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>I represent the main heading of a web page<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
</code></pre>
<p>The <code>h2</code> element represents the second most important heading on the page.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>I am the second most important heading element<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
</code></pre>
<p>There are a total of six section heading elements:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>I am the most important heading element<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>I am the second most important heading element<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">h3</span>&gt;</span>I am the third most important heading element<span class="hljs-tag">&lt;/<span class="hljs-name">h3</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">h4</span>&gt;</span>I am the fourth most important heading element<span class="hljs-tag">&lt;/<span class="hljs-name">h4</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">h5</span>&gt;</span>I am the fifth most important heading element<span class="hljs-tag">&lt;/<span class="hljs-name">h5</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">h6</span>&gt;</span>I am the least important heading element<span class="hljs-tag">&lt;/<span class="hljs-name">h6</span>&gt;</span>
</code></pre>
<p>This is what it looks like rendered to the page.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/Screen-Shot-2022-06-18-at-9.19.27-PM.png" alt="Screen-Shot-2022-06-18-at-9.19.27-PM" width="600" height="400" loading="lazy"></p>
<p>To learn more about heading elements, you can read through this <a target="_blank" href="https://devdocs.io/html/element/heading_elements">DevDocs detailed heading elements explanation</a>.</p>
<h2 id="heading-paragraph-element">Paragraph element</h2>
<p>Paragraph elements represent the paragraphs on a web page.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>I love learning with freeCodeCamp. They have thousands of free articles and videos to help me learn how to code.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<p>This is what it looks like rendered to the page:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/Screen-Shot-2022-06-18-at-9.55.21-PM.png" alt="Screen-Shot-2022-06-18-at-9.55.21-PM" width="600" height="400" loading="lazy"></p>
<p>To learn more about paragraph elements, you can read through this <a target="_blank" href="https://devdocs.io/html/element/p">DevDocs <code>p</code> element detailed explanation</a>.</p>
<h2 id="heading-header-element">Header element</h2>
<p>The <code>header</code> element contains introductory content of the web page. This can include elements like a <code>nav</code>, <code>h1</code> or website logo. </p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">header</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"link-for-logo"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">"description for fake logo goes here"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">nav</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"/"</span>&gt;</span>Home<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#bio"</span>&gt;</span>Bio<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#projects"</span>&gt;</span>Projects<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">nav</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">header</span>&gt;</span>
</code></pre>
<h2 id="heading-main-element">Main element</h2>
<p>The <code>main</code> element is used to group all of the main content of the web page.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>What freeCodeCamp has to offer<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">main</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>The core freeCodeCamp curriculum teaches full stack JavaScript and Python. There are hundreds of lessons to go through to get you ready for an entry level developer job.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>

  <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>freeCodeCamp has thousands of free articles on their news publication. They also have hundreds of videos on their YouTube channel.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">main</span>&gt;</span>
</code></pre>
<p>This is what the code looks like rendered to the page.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/Screen-Shot-2022-06-18-at-10.34.18-PM.png" alt="Screen-Shot-2022-06-18-at-10.34.18-PM" width="600" height="400" loading="lazy"></p>
<p>To learn more about the <code>main</code> element, you can read through this <a target="_blank" href="https://devdocs.io/html/element/main">DevDocs detailed <code>main</code> element explanation</a>.</p>
<h2 id="heading-section-elements">Section elements</h2>
<p>The <code>section</code> element is used to group sections of content in the HTML document.</p>
<p>Here is an example of the <code>section</code> element:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Let's learn about section elements<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">section</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>Defintion<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>The section element is used to group sections of content in the HTML document.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>
</code></pre>
<p>This is what the result looks like rendered to the page.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/Screen-Shot-2022-06-25-at-9.34.22-PM.png" alt="Screen-Shot-2022-06-25-at-9.34.22-PM" width="600" height="400" loading="lazy"></p>
<p>To learn more about <code>section</code> elements, you can read through this <a target="_blank" href="https://devdocs.io/html/element/section">DevDocs <code>section</code> element detailed explanation</a>.</p>
<h2 id="heading-style-element">Style element</h2>
<p>The <code>style</code> element contains the styling for the web page. This is known as internal CSS.</p>
<p>The <code>style</code> element goes inside the <code>head</code> tags.</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">style</span>&gt;</span><span class="css">
    <span class="hljs-comment">/*Styles will go inside here*/</span>
  </span><span class="hljs-tag">&lt;/<span class="hljs-name">style</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
  <span class="hljs-comment">&lt;!--website content goes inside here--&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>To learn more, you can read through this helpful <a target="_blank" href="https://devdocs.io/html/element/style">DevDocs explanation on the <code>style</code> element</a>.</p>
<h2 id="heading-text-align-property-in-css"><code>text-align</code> Property in CSS</h2>
<p>When you are working with heading or paragraph tags, the default styling in HTML will position the text on the left hand side of the page.</p>
<p>In this example, we have an <code>&lt;h1&gt;</code> which is placed on the upper left hand side of the page.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Let's learn about centering text<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/04/Screen-Shot-2022-04-24-at-11.41.12-AM.png" alt="Screen-Shot-2022-04-24-at-11.41.12-AM" width="600" height="400" loading="lazy"></p>
<p>If we wanted to horizontally center that text on the page, then we can use the <code>text-align</code> property.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">h1</span> {
  <span class="hljs-attribute">text-align</span>: center;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/04/Screen-Shot-2022-04-24-at-11.42.48-AM.png" alt="Screen-Shot-2022-04-24-at-11.42.48-AM" width="600" height="400" loading="lazy"></p>
<p>To learn more, you can read through this helpful article on centering text: <a target="_blank" href="https://www.freecodecamp.org/news/text-align-in-css-how-to-align-text-in-center-with-html/">Text Align in CSS – How to Align Text in Center with HTML</a>.</p>
<h2 id="heading-grouping-css-selectors">Grouping CSS selectors</h2>
<p>If you have multiple CSS selectors with the same styles, then you can group them together like this:</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">h1</span>, <span class="hljs-selector-tag">h2</span>, <span class="hljs-selector-tag">h3</span> {
    <span class="hljs-attribute">text-align</span>: center;
}
</code></pre>
<p>Notice how the <code>h1</code>, <code>h2</code> and <code>h3</code> are separated by commas. Grouping multiple CSS selectors together cleans up your CSS and removes repetition. </p>
<p>You can <a target="_blank" href="https://www.freecodecamp.org/news/css-combinators-to-select-elements/">read more about CSS combinators here</a>.</p>
<h2 id="heading-linking-external-stylesheets">Linking External Stylesheets</h2>
<p>The <code>link</code> element is used in most cases to link an external stylesheet to the HTML document. Using external CSS is preferred in most cases to help keep your HTML and CSS in separate documents for readability. </p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"stylesheet"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"style.css"</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p><code>rel="stylesheet"</code> defines the relationship between the HTML file and the external stylesheet.</p>
<p>To learn more, you can read this <a target="_blank" href="https://devdocs.io/html/element/link">DevDocs example on <code>link</code> elements</a>.</p>
<h2 id="heading-viewport-meta-tag">Viewport meta tag</h2>
<p>This tag renders the width of the page to the width of the device's screen size. If you have a mobile device that is 600px wide, then the browser window will also be 600px wide.</p>
<p>The initial-scale controls the zoom level. The value of 1 for the initial-scale prevents the default zoom by browsers.</p>
<pre><code class="lang-html">    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;</span>
</code></pre>
<h2 id="heading-background-color-property"><code>background-color</code> property</h2>
<p>You can change the background color of an HTML element by using the CSS <code>background-color</code> property.</p>
<p>Let's say we have this HTML markup.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Let's learn about the background-color property<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>We are learning about background colors<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<p>I wanted to change the background color from the default of white to pink. We can target the <code>body</code> selector and use <code>background-color: pink;</code></p>
<pre><code class="lang-css"><span class="hljs-selector-tag">body</span> {
  <span class="hljs-attribute">background-color</span>: pink;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/07/Screen-Shot-2022-07-02-at-10.57.53-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>To learn more, you can read through this helpful article: <a target="_blank" href="https://www.freecodecamp.org/news/css-background-color-how-to-change-the-background-color-in-html/">CSS Background Color – How to Change the Background Color in HTML</a>.</p>
<h2 id="heading-div-element">Div element</h2>
<p>The <code>div</code> HTML element is used to group multiple HTML elements and represents a generic container. This element holds no semantic meaning and is mainly used for styling purposes. </p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Let's learn about divs<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>div elements are generic containers to group elements<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<p>To learn more, you can read through this helpful article: <a target="_blank" href="https://www.freecodecamp.org/news/html-div-what-is-a-div-tag-and-how-to-style-it-with-css/">HTML Div – What is a Div Tag and How to Style it with CSS</a>.</p>
<h2 id="heading-css-width-property">CSS width property</h2>
<p>The <code>width</code> property will set the width for the HTML element. </p>
<p>In this example, I want to set the width of this <code>div</code> to 200px.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">div</span> {
  <span class="hljs-attribute">width</span>: <span class="hljs-number">200px</span>;
}
</code></pre>
<p>To learn more, you can read through this helpful <a target="_blank" href="https://devdocs.io/css/width">DevDocs explanation</a> on the width property. </p>
<h2 id="heading-css-comments">CSS comments</h2>
<p>If you need to comment out code or leave messages for yourself or other developers, you can use comments. </p>
<p>Here is the basic syntax for a comment in CSS:</p>
<pre><code class="lang-css"><span class="hljs-comment">/* this is a comment in CSS */</span>
</code></pre>
<p>Anything inside that comment tag will not be rendered to the web page.</p>
<p>In this example, we have some HTML markup.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>CSS comments<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"red-text"</span>&gt;</span>This is some demo text<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<p>For the CSS, I have changed the text color to red and increased the font size.</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.red-text</span> {
  <span class="hljs-attribute">font-size</span>: <span class="hljs-number">1.2rem</span>;
  <span class="hljs-attribute">color</span>: red;
}
</code></pre>
<p>Here is the current result:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/07/Screen-Shot-2022-07-09-at-9.33.31-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>If I comment out the red text color, then the text will go back to black.</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.red-text</span> {
  <span class="hljs-attribute">font-size</span>: <span class="hljs-number">1.2rem</span>;
  <span class="hljs-comment">/* color: red; */</span>
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/07/Screen-Shot-2022-07-09-at-9.34.30-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-margin-property">Margin property</h2>
<p>The <code>margin</code> property represents the space around the HTML element. There are four different margin properties:</p>
<ul>
<li><code>margin-left</code></li>
<li><code>margin-right</code></li>
<li><code>margin-top</code></li>
<li><code>margin-bottom</code></li>
</ul>
<p>In this first example, we have two <code>div</code> elements which represent blue and red boxes.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"blue-box"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"red-box"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-class">.blue-box</span>,
<span class="hljs-selector-class">.red-box</span> {
  <span class="hljs-attribute">width</span>: <span class="hljs-number">200px</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">200px</span>;
}

<span class="hljs-selector-class">.blue-box</span> {
  <span class="hljs-attribute">background-color</span>: blue;
}

<span class="hljs-selector-class">.red-box</span> {
  <span class="hljs-attribute">background-color</span>: red;
}
</code></pre>
<p>Here is what the result looks like rendered to the page:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/07/Screen-Shot-2022-07-09-at-10.26.01-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>If we want to created some space between the red and blue boxes we can use the <code>margin</code> property. I am going to add a <code>margin-bottom: 20px;</code> to the blue box to create space. </p>
<pre><code class="lang-css"><span class="hljs-selector-class">.blue-box</span> {
  <span class="hljs-attribute">background-color</span>: blue;
  <span class="hljs-attribute">margin-bottom</span>: <span class="hljs-number">20px</span>;
}
</code></pre>
<p>This is what the result looks like:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/07/Screen-Shot-2022-07-09-at-10.27.39-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>We can also center both boxes, by setting the <code>margin-left</code> and <code>margin-right</code> properties to <code>auto</code>.</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.blue-box</span>,
<span class="hljs-selector-class">.red-box</span> {
  <span class="hljs-attribute">width</span>: <span class="hljs-number">200px</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">200px</span>;
  <span class="hljs-attribute">margin-left</span>: auto;
  <span class="hljs-attribute">margin-right</span>: auto;
}
</code></pre>
<p>Here is the result:</p>
<div class="embed-wrapper">
        <iframe width="100%" height="350" src="https://codepen.io/jessica-wilkins/embed/yLKJyjV?editors=1100" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="CodePen embed" scrolling="no" allowtransparency="true" allowfullscreen="true" loading="lazy"></iframe></div>
<p>In this next example, we have a green box, a blue box, and some text on the page. We can use the <code>margin-left</code>, <code>margin-right</code>, <code>margin-top</code>, and <code>margin-bottom</code> properties to create spaces between the text and boxes.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"text"</span>&gt;</span>Margin shorthand property<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"green-box"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"text"</span>&gt;</span>Margins create space around HTML elements<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"blue-box"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"text"</span>&gt;</span>CSS is fun<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-class">.text</span> {
  <span class="hljs-attribute">text-align</span>: center;
}
<span class="hljs-selector-class">.blue-box</span>,
<span class="hljs-selector-class">.green-box</span> {
  <span class="hljs-attribute">width</span>: <span class="hljs-number">200px</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">200px</span>;
  <span class="hljs-attribute">margin-left</span>: auto;
  <span class="hljs-attribute">margin-right</span>: auto;
  <span class="hljs-attribute">margin-top</span>: <span class="hljs-number">20px</span>;
  <span class="hljs-attribute">margin-bottom</span>: <span class="hljs-number">20px</span>;
}

<span class="hljs-selector-class">.blue-box</span> {
  <span class="hljs-attribute">background-color</span>: blue;
}

<span class="hljs-selector-class">.green-box</span> {
  <span class="hljs-attribute">background-color</span>: green;
}
</code></pre>
<p>Here is the result:</p>
<div class="embed-wrapper">
        <iframe width="100%" height="350" src="https://codepen.io/jessica-wilkins/embed/gOeMbjN?editors=1100" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="CodePen embed" scrolling="no" allowtransparency="true" allowfullscreen="true" loading="lazy"></iframe></div>
<p>For the blue and green boxes, we can clean up our code here and place all of these <code>margin</code> styles all in one line.</p>
<pre><code class="lang-css">  <span class="hljs-selector-tag">margin-left</span>: <span class="hljs-selector-tag">auto</span>;
  <span class="hljs-selector-tag">margin-right</span>: <span class="hljs-selector-tag">auto</span>;
  <span class="hljs-selector-tag">margin-top</span>: 20<span class="hljs-selector-tag">px</span>;
  <span class="hljs-selector-tag">margin-bottom</span>: 20<span class="hljs-selector-tag">px</span>;
</code></pre>
<p>The <code>margin</code> shorthand property is used to set the margin for all sides of the element. If two values are present, then the first value represents the top &amp; bottom margins while the second value represents the left &amp; right margins. </p>
<pre><code class="lang-css">  <span class="hljs-selector-tag">margin</span>: 20<span class="hljs-selector-tag">px</span> <span class="hljs-selector-tag">auto</span>;
</code></pre>
<p>To learn more about the <code>margin</code> shorthand property, you can read through <a target="_blank" href="https://devdocs.io/css/margin">this helpful DevDocs explanation</a>. </p>
<h2 id="heading-class-selectors">Class selectors</h2>
<p>If you wanted a group of HTML elements to share the same styles, then you would use the <code>class</code> attribute. </p>
<p>Here is an example of how to apply a class to an HTML element.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"title"</span>&gt;</span>Jessica Wilkins blog<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
</code></pre>
<p>Then in your CSS, you can target that class and add some styles to it. </p>
<p>Here is an example of turning that text red, using CSS. Note, that you need to precede that class name with a <code>.</code> which tells the computer that you want to use a class selector.</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.title</span> {
  <span class="hljs-attribute">color</span>: red;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-8.14.24-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-background-image-property">background-image property</h2>
<p>The <code>background-image</code> property is used to set the background image for an HTML element. </p>
<p>In this example, we are going to apply a background image of lasagna to the <code>body</code> element. </p>
<pre><code class="lang-css"><span class="hljs-selector-tag">body</span> {
  <span class="hljs-attribute">background-image</span>: <span class="hljs-built_in">url</span>(<span class="hljs-string">"https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg"</span>);
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-8.38.43-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The reason why this image is repeating on the screen is because that is the default behavior for the <code>background-image</code> property. You could use <code>background-repeat: no-repeat;</code> to change that default behavior. </p>
<h2 id="heading-article-element">Article element</h2>
<p>The <code>article</code> element is a semantic HTML element that is used for independent self contained content.  </p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">article</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>Blog entry #3<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
  content goes here...
<span class="hljs-tag">&lt;/<span class="hljs-name">article</span>&gt;</span>
</code></pre>
<h2 id="heading-block-inline-and-inline-block-values">Block, inline and inline-block values</h2>
<p>The <code>display</code> property is used to apply block or inline characteristics to an element. Block level elements take up the full horizontal space on the page while inline elements only take up the horizontal space for that element. </p>
<p>Inline elements will not work with width and height properties. The <code>margin</code> left and right values will work for inline elements but not the top and bottom values.</p>
<p>You can have multiple inline elements displayed in a row while you can have only one block level element per row. Here is an example for multiple inline elements in a row:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">""</span>&gt;</span>this is link 1<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">""</span>&gt;</span>this is link 2<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">""</span>&gt;</span>this is link 3<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-9.37.55-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>You can use the <code>display:block;</code> value on these anchor element to change their default behavior and set it to block characteristics. </p>
<pre><code class="lang-css"><span class="hljs-selector-tag">a</span> {
  <span class="hljs-attribute">display</span>: block;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-12.40.45-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>This next example is for multiple block level elements. Notice how each of these <code>divs</code> takes up the entire horizontal space on the page and they are not displayed next to each other. </p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box red"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box green"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"box blue"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-9.42.27-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>This last value is called <code>inline-block</code> which will treat elements as inline but will also have characteristics of block level elements. </p>
<p>Here is an example of two paragraph elements that are block level elements by default.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This is paragraph 1.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This is paragraph 2.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-9.47.44-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>I can set the width, margin, padding and <code>background-color</code> for these <code>p</code> elements. </p>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#89cff0</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100px</span>;
  <span class="hljs-attribute">margin</span>: <span class="hljs-number">20px</span>;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">15px</span>;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-9.52.04-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>We can add <code>display: inline-block;</code> to place the paragraph elements next to each other.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#89cff0</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100px</span>;
  <span class="hljs-attribute">margin</span>: <span class="hljs-number">20px</span>;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">15px</span>;
  <span class="hljs-attribute">display</span>: inline-block;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-9.53.52-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-padding">Padding</h2>
<p>In CSS, you can add padding to create space around the element's content. </p>
<p>In this example we have a paragraph element with a pink background that uses no padding.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This is an example without padding<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">background-color</span>: pink;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100px</span>;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-11.44.34-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Notice how the text is right up against the border of the <code>p</code> element. That is because we haven't added any padding. </p>
<p>If we want to create space around that text, then we can use padding. Let's add 10px of padding on all sides of the text.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">background-color</span>: pink;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100px</span>;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">10px</span>;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-11.57.14-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>If we only wanted to add padding to the left and right sides, then we can use the <code>padding-left</code> and <code>padding-right</code> properties.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">background-color</span>: pink;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100px</span>;
  <span class="hljs-attribute">padding-left</span>: <span class="hljs-number">10px</span>;
  <span class="hljs-attribute">padding-right</span>: <span class="hljs-number">10px</span>;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-11.57.40-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>We can also modify it so there is only space around the top and bottom of the text. </p>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">background-color</span>: pink;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100px</span>;
  <span class="hljs-attribute">padding-top</span>: <span class="hljs-number">10px</span>;
  <span class="hljs-attribute">padding-bottom</span>: <span class="hljs-number">10px</span>;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-11.58.03-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Similar to the <code>margin</code> property, you can use a shorthand notation to apply different types of padding to the top, left, right, and bottom sides. </p>
<p>In this example we are going to add 10px of padding to the top and bottom of the text and add 15px of padding to the left and right sides of the text. </p>
<p>Without the shorthand property the code would look like this:</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">background-color</span>: pink;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100px</span>;
  <span class="hljs-attribute">padding-left</span>: <span class="hljs-number">15px</span>;
  <span class="hljs-attribute">padding-right</span>: <span class="hljs-number">15px</span>;
  <span class="hljs-attribute">padding-top</span>: <span class="hljs-number">10px</span>;
  <span class="hljs-attribute">padding-bottom</span>: <span class="hljs-number">10px</span>;
}
</code></pre>
<p>But we can use the shorthand notation to achieve the same result. The first number in the padding property represents the top and bottom while the second number represents the left and right. </p>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">background-color</span>: pink;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">100px</span>;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">10px</span> <span class="hljs-number">15px</span>;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-05-at-11.58.42-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>To learn more about the padding shorthand notation, you can read through this helpful <a target="_blank" href="https://devdocs.io/css/padding">DevDocs explanation</a>. </p>
<h2 id="heading-max-width-property"><code>max-width</code> property</h2>
<p>The <code>max-width</code> property is useful when you want to set a maximum width for an element. </p>
<p>In this example, we have a red container with a <code>width</code> set to 70% of the viewport width.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"red-container"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-class">.red-container</span> {
  <span class="hljs-attribute">width</span>: <span class="hljs-number">70%</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">40px</span>;
  <span class="hljs-attribute">background-color</span>: red;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-1.11.27-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>We can use the <code>max-width</code> property to set a maximum width of 1000px to this red container. </p>
<pre><code class="lang-css"><span class="hljs-selector-class">.red-container</span> {
  <span class="hljs-attribute">width</span>: <span class="hljs-number">70%</span>;
  <span class="hljs-attribute">max-width</span>: <span class="hljs-number">1000px</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">40px</span>;
  <span class="hljs-attribute">background-color</span>: red;
}
</code></pre>
<p>Now, when the viewport is larger than 1000px, the width will no longer be set to 70% of the viewport. Instead, it will stay at the maximum width of 1000px. </p>
<h2 id="heading-font-family-property"><code>font-family</code> property</h2>
<p>In design, a <code>font-family</code> represents a collection of fonts that share similar design characteristics. Here are some examples of some font families:</p>
<pre><code>Times, Times New Roman, serif    
Comic Sans MS, Comic Sans, cursive
</code></pre><p>In CSS, you can use the <code>font-family</code> property to apply a set of fonts to given elements.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Let's learn about font families<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This is an example on how to use the font-family CSS property<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-tag">body</span> {
  <span class="hljs-attribute">font-family</span>: Comic Sans MS, Comic Sans, cursive;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-1.28.01-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The browser will select the first font in the list and display if it is available. If that font is not available, then it will move onto the next font in the list. </p>
<p>It is good practice to provide a fallback font in the event that the other fonts in the list are not available to the browser.  In our example, <code>cursive</code> would considered the fallback if Comic Sans MS and Comic Sans were not available. </p>
<h2 id="heading-font-style-property"><code>font-style</code> property</h2>
<p>The <code>font-style</code> property is used to set the text in a normal, italic, or oblique font style. </p>
<p>Here is an example of setting the text to an italic <code>font-style</code>.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>This example is about the font-style property<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-tag">h1</span> {
  <span class="hljs-attribute">font-style</span>: italic;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-1.36.57-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>It's important not to use the <a target="_blank" href="https://www.freecodecamp.org/news/html-italics-tutorial-how-to-make-text-italic-with-the-i-tag/">HTML <code>i</code> (Idiomatic Text) element</a> for styling text in italics. When it comes to styling text, you should always use the <code>font-style</code> property. </p>
<h2 id="heading-font-size-property"><code>font-size</code> property</h2>
<p>The <code>font-size</code> property is used to change the font sizes for HTML elements like headings and paragraphs. Here are some common values that you can use with the <code>font-size</code> property: </p>
<ul>
<li>xx-small,  x-small, small, medium, large, x-large, xx-large, xxx-large</li>
<li>smaller, larger </li>
<li>px, em, rem</li>
<li>percentages (for example, font-size: 60%;)</li>
</ul>
<p>In this example, we are going to set the <code>font-size</code> for this paragraph element to be 20px. </p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This example is about the font-size property<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">font-size</span>: <span class="hljs-number">20px</span>;
}
</code></pre>
<h2 id="heading-footer-elements"><strong>Footer elements</strong></h2>
<p>The <code>footer</code> element is located at the bottom of the HTML document and contains information like copyrights, or links to other related information for the page.</p>
<p>Here is a basic example:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">footer</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>© 2022 Jessica Wilkins<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">footer</span>&gt;</span>
</code></pre>
<p>To learn more about the <code>footer</code> element, you can read through <a target="_blank" href="https://devdocs.io/html/element/footer">this DevDocs explanation of the <code>footer</code> element</a>.</p>
<h2 id="heading-anchor-elements"><strong>Anchor elements</strong></h2>
<p>An anchor element represents a link on the web page.</p>
<p>Here is the basic syntax:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"link-where-you-want-to-go"</span>&gt;</span>anchor text goes here<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
</code></pre>
<p>This is what it looks like rendered to the page:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/Screen-Shot-2022-06-25-at-5.10.07-PM.png" alt="Screen-Shot-2022-06-25-at-5.10.07-PM" width="600" height="400" loading="lazy"></p>
<p>You use the <code>href</code> attribute to tell the hyperlink where to go.</p>
<pre><code class="lang-html">href="link-where-you-want-to-go"
</code></pre>
<p>The anchor text is what gets displayed on the screen to users.</p>
<p>Here is an example of an anchor tag that links to freeCodeCamp:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"https://www.freecodecamp.org/"</span>&gt;</span>freeCodeCamp<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
</code></pre>
<p>This is what it looks like rendered to the page.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/Screen-Shot-2022-06-25-at-5.41.36-PM.png" alt="Screen-Shot-2022-06-25-at-5.41.36-PM" width="600" height="400" loading="lazy"></p>
<p>To learn more about HTML anchor elements, I suggest reading through these helpful articles:</p>
<ul>
<li><a target="_blank" href="https://www.freecodecamp.org/news/the-html-a-tag-anchor-tag-example-code/">The HTML </a><a> Tag – Anchor Tag Example Code</a></li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/html-a-tag-anchor-link-href-example/">HTML </a><a> Tag – Anchor Link HREF Example</a></li>
</ul>
<h2 id="heading-hr-element"><code>hr</code> element</h2>
<p>The <code>hr</code> (Horizontal Rule) element is used to created breaks between the paragraph elements. </p>
<p>Here is an example of how to use the <code>hr</code> element between two paragraph elements. <code>hr</code> elements are self closing. </p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This is paragraph 1<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">hr</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This is paragraph 2<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-1.02.23-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>You can style the <code>hr</code> element by changing its border and color. </p>
<pre><code class="lang-css"><span class="hljs-selector-tag">hr</span> {
  <span class="hljs-attribute">border</span>: <span class="hljs-number">5px</span> solid red;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-1.05.39-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-height-property">Height property</h2>
<p>The <code>height</code> property in CSS is used to set the height for an HTML element. Here is an example where we have a blue container with a height of 50px.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"blue-container"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-class">.blue-container</span> {
  <span class="hljs-attribute">background-color</span>: blue;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">30px</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">50px</span>;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-1.11.44-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>To learn more about the <code>height</code> property, you can read through this helpful <a target="_blank" href="https://devdocs.io/css/height">DevDocs explanation</a>. </p>
<h2 id="heading-border-color-property"><code>border-color</code> property</h2>
<p>The <code>border-color</code> property is used to set the color for an element's border.</p>
<p>In this example, we are going to create two paragraph elements with different border colors. The first step is to set the border widths and style. </p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"para1"</span>&gt;</span>This is paragraph one with a green border<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"para2"</span>&gt;</span>This is paragraph two with a blue border<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">border-style</span>: solid;
  <span class="hljs-attribute">border-width</span>: <span class="hljs-number">3px</span>;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-1.21.11-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Then we can set the first paragraph to have a border color of green and the second paragraph to have a border color of blue. </p>
<pre><code class="lang-css"><span class="hljs-selector-class">.para1</span> {
  <span class="hljs-attribute">border-color</span>: green;
}

<span class="hljs-selector-class">.para2</span> {
  <span class="hljs-attribute">border-color</span>: blue;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-1.22.36-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>We can rewrite our example to use the border shorthand notation to apply the border width, color, and style all at the same time.</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.para1</span> {
  <span class="hljs-attribute">border</span>: <span class="hljs-number">3px</span> solid green;
}

<span class="hljs-selector-class">.para2</span> {
  <span class="hljs-attribute">border</span>: <span class="hljs-number">3px</span> solid blue;
}
</code></pre>
<h2 id="heading-color-property">Color property</h2>
<p>You can change the color of the text by using the <code>color</code> property. Here is an example to change the paragraph text to blue:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This is an example for the color property<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">color</span>:blue;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-1.30.47-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-pseudo-classes">Pseudo-classes</h2>
<p>Pseudo-classes are special keywords that you can add to CSS selectors to show the specific state of an HTML element. </p>
<p>In this first example, we are going to create a blue button that changes to a darker shade of blue when the user hovers over it. We can use the <code>:hover</code> pseudo-class to achieve that result. </p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">button</span>&gt;</span>Login<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
</code></pre>
<pre><code class="lang-css"><span class="hljs-selector-tag">button</span> {
  <span class="hljs-attribute">border</span>: none;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">10px</span>;
  <span class="hljs-attribute">font-size</span>: <span class="hljs-number">20px</span>;
  <span class="hljs-attribute">color</span>: white;
  <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#0e3386</span>;
  <span class="hljs-attribute">cursor</span>: pointer;
}

<span class="hljs-selector-tag">button</span><span class="hljs-selector-pseudo">:hover</span> {
  <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#041e42</span>;
}
</code></pre>
<div class="embed-wrapper">
        <iframe width="100%" height="350" src="https://codepen.io/jessica-wilkins/embed/ExRgXod" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="CodePen embed" scrolling="no" allowtransparency="true" allowfullscreen="true" loading="lazy"></iframe></div>
<p>In this next example, we are going to use CSS pseudo-classes to style the different states for a link. </p>
<p>The <code>:link</code> pseudo-class is used to show the initial state of the link. </p>
<pre><code class="lang-css"><span class="hljs-selector-tag">a</span><span class="hljs-selector-pseudo">:link</span> {
  <span class="hljs-attribute">color</span>: <span class="hljs-number">#0066b2</span>;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-2.01.56-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The <code>:hover</code> pseudo-class is used to show when a user hovers over a link.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">a</span><span class="hljs-selector-pseudo">:hover</span> {
  <span class="hljs-attribute">color</span>: <span class="hljs-number">#13274f</span>;
}
</code></pre>
<p>The <code>:visited</code> pseudo-class is used to show when a user clicks on that link and visits the site. </p>
<pre><code class="lang-css"><span class="hljs-selector-tag">a</span><span class="hljs-selector-pseudo">:visited</span> {
  <span class="hljs-attribute">color</span>: <span class="hljs-number">#5a4fcf</span>;
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-06-at-2.11.03-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>You can play around with this CodePen example to see the different link states. </p>
<div class="embed-wrapper">
        <iframe width="100%" height="350" src="https://codepen.io/jessica-wilkins/embed/RwJGgyP?editors=1100#_=_" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="CodePen embed" scrolling="no" allowtransparency="true" allowfullscreen="true" loading="lazy"></iframe></div>
<p>If you want to learn more about pseudo-classes, then you can read through this <a target="_blank" href="https://www.freecodecamp.org/news/explained-css-pseudo-classes-cef3c3177361/">helpful article</a>. </p>
<h2 id="heading-image-elements"><strong>Image elements</strong></h2>
<p><code>img</code> elements are used to add images to the web page.</p>
<p>The <code>src</code> attribute represents the location of the image and the <code>alt</code> attribute is descriptive text for the image.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">"plate of lasagna"</span>&gt;</span>
</code></pre>
<p>This is the what code looks like rendered to the page:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/Screen-Shot-2022-06-18-at-11.41.23-PM.png" alt="Screen-Shot-2022-06-18-at-11.41.23-PM" width="600" height="400" loading="lazy"></p>
<p>To learn more about the <code>img</code> element, you can read through this helpful <a target="_blank" href="https://www.freecodecamp.org/news/img-html-image-tag-tutorial/"><code>img</code> element tutorial</a>.</p>
<h2 id="heading-additional-resources-for-html-and-css">Additional resources for HTML and CSS</h2>
<p>Thanks for reading! Here are some more helpful resources to get you comfortable with CSS:</p>
<ul>
<li><a target="_blank" href="https://www.youtube.com/watch?v=OXGznpKZ_sA">CSS Tutorial – Full Course for Beginners</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=1Rs2ND1ryYc">CSS Tutorial - Zero to Hero (Complete Course)</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=a_iQb1lnAEQ">Learn HTML &amp; CSS – Full Course for Beginners</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=srvUrASNj0s">Introduction To Responsive Web Design - HTML &amp; CSS Tutorial</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=kMT54MPz9oE">HTML and CSS Tutorial - Create a Website for Beginners</a>  </li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ What I Learned from Maintaining a Repo During Hacktoberfest and Merging 356 PRs ]]>
                </title>
                <description>
                    <![CDATA[ Hacktoberfest is a month long celebration of open source. And this year I participated as a maintainer for freeCodeCamp's Developer Quiz Site. I merged a total of 356 pull requests and helped a lot of new contributors get started with open source. We... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/what-i-learned-as-a-hacktoberfest-repo-maintainer/</link>
                <guid isPermaLink="false">66b8da66eb5c4db85a0b3444</guid>
                
                    <category>
                        <![CDATA[ freeCodeCamp.org ]]>
                    </category>
                
                    <category>
                        <![CDATA[ hacktoberfest ]]>
                    </category>
                
                    <category>
                        <![CDATA[ lessons learned ]]>
                    </category>
                
                    <category>
                        <![CDATA[ open source ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Wed, 02 Nov 2022 16:17:06 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-5.56.25-PM.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Hacktoberfest is a month long celebration of open source. And this year I participated as a maintainer for <a target="_blank" href="https://github.com/freeCodeCamp/Developer_Quiz_Site">freeCodeCamp's Developer Quiz Site</a>.</p>
<p>I merged a total of 356 pull requests and helped a lot of new contributors get started with open source. We were able to add a total of 477 new quiz questions to the <a target="_blank" href="https://developerquiz.org/">Developer Quiz Site</a>. </p>
<p>Here are some more statistics: </p>
<h3 id="heading-stats-on-oct-1-2022">Stats on Oct 1, 2022</h3>
<p>Number of questions: 694</p>
<p>Forks: 61</p>
<p>Stars:42</p>
<h3 id="heading-stats-on-november-1-2022">Stats on November 1, 2022</h3>
<p>Number of questions: 1171</p>
<p>Forks: 246</p>
<p>Stars: 109</p>
<p>This month long journey has been crazy, productive, fun and educational. Here are all of the things that I learned during Hacktoberfest 2022.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><a class="post-section-overview" href="#heading-how-it-all-began">How it all began</a></li>
<li><a class="post-section-overview" href="#heading-preparing-for-hacktoberfest">Preparing for Hacktoberfest</a><ul>
<li><a class="post-section-overview" href="#heading-step-1-adding-the-hacktoberfest-topic-and-labels">Step 1: Adding the Hacktoberfest topic and labels</a></li>
<li><a class="post-section-overview" href="#heading-step-2-creating-issue-templates">Step 2: Creating issue templates</a></li>
<li><a class="post-section-overview" href="#heading-step-3-updating-the-contributing-documentation">Step 3: Updating the contributing documentation</a></li>
<li><a class="post-section-overview" href="#heading-step-4-creating-well-defined-issues">Step 4: Creating well-defined issues</a></li>
<li><a class="post-section-overview" href="#heading-step-5-adding-saved-replies">Step 5: Adding Saved replies</a></li>
<li><a class="post-section-overview" href="#heading-step-6-opening-up-github-discussions">Step 6: Opening up GitHub Discussions</a></li>
</ul>
</li>
<li><a class="post-section-overview" href="#heading-lessons-i-learned-during-hacktoberfest">Lessons I learned during Hacktoberfest</a><ul>
<li><a class="post-section-overview" href="#heading-lead-with-patience-empathy-and-kindness">Lead with patience, empathy and kindness</a></li>
<li><a class="post-section-overview" href="#dont-get-worked-up-over-spam">Don't get worked up over spam</a></li>
<li><a class="post-section-overview" href="#how-to-gracefully-close-prs-that-will-not-be-accepted">How to gracefully close PR's that will not be accepted</a></li>
</ul>
</li>
<li><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></li>
</ul>
<h2 id="heading-how-it-all-began">How it All Began</h2>
<p>In December of 2021, freeCodeCamp was launching their <a target="_blank" href="https://www.freecodecamp.org/news/learn-to-code-rpg/">Learn to Code RPG game</a>. It's an interactive visual novel that follows Lydia's dream of becoming a developer. </p>
<p>I was involved with helping to create quiz questions on topics like HTML, CSS, Computer Science, Python, and so on for the initial launch. </p>
<p>About a week before the launch, Quincy approached me and a few others to build out a <a target="_blank" href="https://developerquiz.org/">Developer Quiz Site</a>. This was meant to be a companion site to the <a target="_blank" href="https://www.freecodecamp.org/news/learn-to-code-rpg/">Learn to Code RPG game</a> and provide campers with a way to practice more quiz questions outside of the game. </p>
<p>The initial launch of the <a target="_blank" href="https://developerquiz.org/">Developer Quiz Site</a> had about 600+ quiz questions. We also created a few open issues in the <a target="_blank" href="https://github.com/freeCodeCamp/Developer_Quiz_Site">repository</a> for the community to add more questions to the site. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-6.11.55-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>During parts of 2022, there was a moderate amount of activity in the repository but a lot of the time it remained rather slow. But once September rolled around, I thought about entering the <a target="_blank" href="https://developerquiz.org/">Developer Quiz Site</a> into Hacktoberfest.</p>
<p>I reached out to Quincy and he thought it was a great idea because we could use this opportunity to get more quiz questions from the community.</p>
<h2 id="heading-preparing-for-hacktoberfest">Preparing for Hacktoberfest</h2>
<p>There were about 3 weeks left before Hacktoberfest started. Here is how I used that time to get the repository ready.</p>
<h3 id="heading-step-1-adding-the-hacktoberfest-topic-and-labels">Step 1: Adding the Hacktoberfest topic and labels</h3>
<p>The first step was to add the Hacktoberfest topic to the repository so people knew we were participating in this year's event. I spruced up the About section and added the appropriate labels to help invite people to the repository. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-6.41.14-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>I then made sure to create the <code>hacktoberfest-accepted</code> label so I could apply it to each approved PR to help us keep track of the total number of Hacktoberfest PR's. I also added the <code>spam</code>, <code>hacktoberfest</code>, and <code>first-timers-only</code> labels because I knew they would come in handy. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-6.45.45-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-step-2-creating-issue-templates">Step 2: Creating issue templates</h3>
<p><a target="_blank" href="https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository">GitHub issue templates</a> are a great way to ensure that contributors provide all of the necessary information for bug fixes, documentation changes, feature requests or general issues.  </p>
<p>I decided to setup 5 issue categories and make certain fields required so contributors would provide some level of detail to the issues they were creating.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-6.57.28-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-6.53.25-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-step-3-updating-the-contributing-documentation">Step 3: Updating the contributing documentation</h3>
<p>When the repository was initially created, the contributing documentation pointed to the <a target="_blank" href="https://contribute.freecodecamp.org./#/">general freeCodeCamp contributing guidelines</a>. While that documentation is very thorough, it wasn't specific enough on how people could best contribute to the <a target="_blank" href="https://github.com/freeCodeCamp/Developer_Quiz_Site">Developer Quiz site repository</a> in particular. </p>
<p>I decided to completely overhaul the documentation and create a new in depth file just for the Developer Quiz Site. Since I anticipated that we would have a lot of beginners with Git and GitHub, I tried to make it as accessible and beginner friendly as possible.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-7.08.50-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-step-4-creating-well-defined-issues">Step 4: Creating well-defined issues</h3>
<p>In order to attract contributors to our repository, I knew that we needed to have some clearly defined issues. If the issues were too vague, then I knew people would have tons of questions or might not be interested in contributing.</p>
<p>I made sure to include all of the necessary guidelines for submission, including code snippets for the proper formatting, links to the Code of Conduct, Contributing docs, and links to the files they needed to change. </p>
<p>Here is an example of one of the issues I created to encourage more JavaScript questions.</p>
<h4 id="heading-sample-issue">Sample issue</h4>
<p><a target="_blank" href="developerquiz.org">developerquiz.org</a> currently has over 600 quiz questions. We are looking to expand on the JavaScript questions and we encourage other developers to add their quiz questions to the site.</p>
<p><strong>Please note: we are only focusing on general JavaScript questions instead of library and framework specific questions.</strong></p>
<p>You can find the complete list of questions below.
https://github.com/freeCodeCamp/Developer_Quiz_Site/blob/main/src/data/javascript-quiz.ts</p>
<p>You can add your own questions to the top of that file.
<strong>Please first check to make sure your question doesn't already exist in the file before creating a PR.</strong></p>
<p>Here is an example format for the questions. </p>
<pre><code>  {
    <span class="hljs-attr">Question</span>:
      <span class="hljs-string">"In JavaScript, what is the name of the method used to remove white space from the beginning and end of a string?"</span>,
    <span class="hljs-attr">Answer</span>: <span class="hljs-string">".trim()"</span>,
    <span class="hljs-attr">Distractor1</span>: <span class="hljs-string">".substring()"</span>,
    <span class="hljs-attr">Distractor2</span>: <span class="hljs-string">".reduce()"</span>,
    <span class="hljs-attr">Distractor3</span>: <span class="hljs-string">".slice()"</span>,
    <span class="hljs-attr">Explanation</span>:
      <span class="hljs-string">"The .trim() method removes white space (including space, tab, etc.) from both ends of a string and returns a new string without modifying the original."</span>,
    <span class="hljs-attr">Link</span>: <span class="hljs-string">"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim"</span>,
  },
</code></pre><p>For the <code>link</code> field, please make sure to use a freeCodeCamp article, freeCodeCamp YouTube video, or official documentation.
If you choose to reference a video, please make sure to include the timestamp for the topic covered.</p>
<p>You can read more about how to create timestamps in this <a target="_blank" href="https://www.lifewire.com/link-to-specific-part-of-youtube-video-1616414#">helpful article</a>. </p>
<p>This issue will not be assigned to anyone and will remain open for multiple contributors. </p>
<p><strong>Please do not assign yourself to this issue or close it.</strong></p>
<p>Happy contributing!</p>
<p>For most of our issues, I wanted multiple contributors to be able to participate. So I added a disclaimer at the bottom letting people know that it would remain open and wouldn't be assigned to anyone. </p>
<p>I also made sure to add the <code>good-first-issue</code>, <code>help-wanted</code>, and <code>hacktoberfest</code> labels to help attract more contributors. </p>
<h3 id="heading-step-5-adding-saved-replies">Step 5: Adding Saved replies</h3>
<p><a target="_blank" href="https://docs.github.com/en/get-started/writing-on-github/working-with-saved-replies/creating-a-saved-reply">Saved replies</a> is a feature on GitHub were you can create and save your own messages that you intend to use repeatedly in issues and pull requests.  </p>
<p>I decided to create the following replies:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-7.59.09-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>I wanted replies to congratulate both first time and returning contributors because they took the time to make our repository better. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-8.01.40-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>I also wanted to create a reply where I thanked the contributor for their contribution and requested changes to the pull request. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-8.05.29-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The last reply I created was to let contributors know that their pull request was reviewed but was not going to be accepted. I saw that the main <a target="_blank" href="https://github.com/freeCodeCamp/freeCodeCamp">freeCodeCamp learn repository</a> used a similar reply so I wanted to include it in the Developer Quiz Site repository.  </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-8.09.14-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-step-6-opening-up-github-discussions">Step 6: Opening up GitHub Discussions</h3>
<p>A few days before Hacktoberfest started, I wanted to open up another avenue for contributors to ask questions and propose new features. So I decided to open up <a target="_blank" href="https://docs.github.com/en/discussions">GitHub discussions</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-10-31-at-8.14.52-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>When I created this post, we had a few people new to the repository feel welcomed to contribute and happy that there was a place to connect with me and other contributors. </p>
<p>Now that everything was in place, the countdown to Hacktoberfest was underway.</p>
<h2 id="heading-lessons-i-learned-during-hacktoberfest">Lessons I learned during Hacktoberfest</h2>
<p>Right from day 1, I was pretty busy reviewing pull requests and helping new contributors get started in open source. But the whole experience was very educational and rewarding. </p>
<p>Here are a few lessons that I learned during this time.</p>
<h3 id="heading-lead-with-patience-empathy-and-kindness">Lead with patience, empathy, and kindness</h3>
<p>We were all beginners once, and sometimes it is scary to learn something new. I made sure to lead with kindness and empathy because I remember what it was like to just start out in open source. </p>
<p>Every time a new question came in, I made sure to reply back and provide as much as assistance as I could to help them resolve the issue. This resulted in a welcoming and safe environment to learn.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-01-at-6.25.48-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>We also had times where some contributors wanted to add quiz questions but were nervous because English is not their first language. My job was to assure them that I was here to help and not pass judgement on spelling or grammar mistakes. </p>
<p>I believe that helped in the larger volume of quiz questions we ended up getting. </p>
<h3 id="heading-dont-get-worked-up-over-spam">Don't get worked up over spam</h3>
<p>One of the downsides to Hacktoberfest is the increased amount of spam pull requests for open source maintainers. While this is frustrating to deal with, I learned pretty quickly to just close the PR, label it as spam, and move on.</p>
<p>There was no point in arguing with them or getting upset because that is wasted energy. The majority of people did want to meaningfully contribute and that is where I chose to spend my energy.</p>
<h3 id="heading-how-to-gracefully-close-prs-that-will-not-be-accepted">How to gracefully close PR's that will not be accepted</h3>
<p>One of the surprising issues that came up were people wanting to take quiz questions and explanations from other quiz sites and add it to <a target="_blank" href="https://github.com/freeCodeCamp/Developer_Quiz_Site">freeCodeCamp's Developer Quiz Site</a>. The first couple of times this happened, I closed the pull request and let them know that this is plagiarism and we can't accept that. </p>
<p>Well, I received a response back from one contributor stating that they didn't realize and they wanted to know if they could try again. I assured them that they were free to create a new PR and I could help them with any spelling or grammar. </p>
<p>This led me to revise my response to let contributors know that they weren't in trouble and were free to contribute again in the future with their own questions.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screen-Shot-2022-11-01-at-6.42.40-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>This helped to maintain a healthy open source environment and most of those cases ended up being prolific contributors after they understood the rules. </p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>I am really glad that I participated as a maintainer in this year's Hacktoberfest. I learned a lot about communication, empathy, patience, and leadership.</p>
<p>I hope my post encourages you to want to get involved with open source either as a maintainer or contributor in the future. </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ What Does a Software Developer Do? Software Engineer Career Overview ]]>
                </title>
                <description>
                    <![CDATA[ If you're studying to become a professional software developer, you might be wondering what a software developer does everyday on the job. In this article, I will talk about the typical day of a software developer and what to expect on the job.  Main... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/what-does-a-software-developer-do-software-engineer-career-overview/</link>
                <guid isPermaLink="false">66b8da638cd1c2aa053d49bf</guid>
                
                    <category>
                        <![CDATA[ Career development  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ software development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Jessica Wilkins ]]>
                </dc:creator>
                <pubDate>Mon, 15 Aug 2022 14:11:52 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/08/desola-lanre-ologun-IgUR1iX0mqM-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you're studying to become a professional software developer, you might be wondering what a software developer does everyday on the job.</p>
<p>In this article, I will talk about the typical day of a software developer and what to expect on the job. </p>
<h2 id="heading-main-responsibilities-of-a-software-developer">Main Responsibilities of a Software Developer</h2>
<p>As a software developer, your main responsibilities will include fixing bugs in the codebase, building out new features, writing tests for the applications, writing documentation, performing code reviews, and participating in team discussion meetings. </p>
<p>Very experienced developers, like software architects, will be responsible for the higher level technical and architectural decisions for the software applications. </p>
<p>Let's take a look at each of these responsibilities in greater detail. </p>
<h3 id="heading-debugging-codebases-and-fixing-bugs">Debugging Codebases and Fixing Bugs</h3>
<p>When you first start out as a software developer, one of your main responsibilities will be to work on small bug fixes and debugging small errors in the codebase.</p>
<p>There will be a list of tickets (issues) that will break up the work into manageable pieces, and some of them will include bugs in the application.</p>
<p>You will pick up some of the small ticket items which will help you learn the codebase. It is standard as a junior developer to spend the first couple of months ramping up with a codebase and with the new job in general.</p>
<p>Just make sure to ask plenty of questions and try to pair program with other developers on the team. Working with other developers will help you learn new techniques and grow faster. </p>
<p>I have learned a lot from my coworkers, and most of the time a fresh pair of eyes have helped me see the problem in a different way. </p>
<h3 id="heading-building-new-features">Building New Features</h3>
<p>As you start to become more comfortable with the job and gain more experience, you will start to be given more responsibility with the codebase. This is where building out new features comes in. </p>
<p>Features are essential components of the software product. This type of work will take longer than small bug fixes and give you an opportunity to contribute more to the project. </p>
<p>This will also provide you with the opportunity to work on more complex problems and grow more as a developer. The first feature I worked on was to implement a light/dark theme for the company website.</p>
<p>I spent time thinking about the best approach on how to implement this feature for our existing codebase. Then I went about implementing my solution and testing out the website. </p>
<p>The final phase was to go through code reviews and update the website documentation to include the new feature.  </p>
<p>The whole experience taught me how to build out solutions that were maintainable and scalable that would work well with the existing codebase. </p>
<h3 id="heading-writing-tests-for-the-applications">Writing Tests for the Applications</h3>
<p>One important element of software applications is ensure that they work they way they are supposed to work. This is where testing comes in.</p>
<p>Software developers are responsible for writing different types of tests like unit tests, integrated tests, functional tests and more.  They might also engage in manual testing which includes the developer going through the application with a set of test cases and ensuring it is working the way it is supposed to. </p>
<p>One of my first experiences with testing came in the form of smoke testing and writing manual test guides for a couple of our apps. Smoke testing is where the developer will go through the application and ensure that basic functionality is intact. </p>
<p>Writing test guides involves the developer going through all of the features of the application and creating test cases. These test cases involve writing down the exact steps a user should go through and the expected outcome. </p>
<p>The first time I had to write a manual test guide, I didn't realize how specific I needed to be in writing out each step. But once I wrote a few test cases, the process started to make more sense and it became easier to write these manual test cases.</p>
<p>If you are interested to learn more about testing, then I suggest you read <a target="_blank" href="https://www.freecodecamp.org/news/types-of-software-testing/">this helpful freeCodeCamp article</a>. </p>
<h3 id="heading-writing-documentation">Writing Documentation</h3>
<p>Documentation is an important part of any software application. It is important to document the main features of the application as well as all of the steps required to run it locally for developers. </p>
<p>Whenever you join a new project, and you notice anything confusing or missing about the documentation, make sure to bring it up with the team. That would be a good opportunity to update the documentation. </p>
<p>Sometimes when you are working on a project and the team is busy with meeting deadlines, documentation can sometime fall behind. When things calm down a bit, make sure to revisit the documentation and make sure it is up to date and accurate. </p>
<h3 id="heading-performing-code-reviews">Performing Code Reviews</h3>
<p>Building software is a team activity, and it important that everyone on the team has their code reviewed by their peers. When you have made changes to the codebase you will create what is called a pull request. </p>
<p>That pull request represents the changes you want to add to the codebase. You will then request a review from team members and they will look over your code and provide feedback.</p>
<p>It is important to view the feedback as constructive, because your team is just trying to help catch issues and make suggestions on how to optimize your solution.</p>
<p>It is also important to provide constructive feedback and ensure that everything in the pull request fixes the issue or meets the requirements of the new feature.   </p>
<p>To learn more about the code review process, please read through <a target="_blank" href="https://www.freecodecamp.org/news/proven-code-review-best-practices/">this helpful freeCodeCamp article</a>. </p>
<h3 id="heading-participating-in-team-discussion-meetings">Participating in Team Discussion Meetings</h3>
<p>There are a lot of moving components that go into building software products. It is important that the entire team is on the same page during the entire application process. </p>
<p>The goal of these meetings is for each team member to share status updates with the team and share any blockers that are preventing them from moving forward on the project. If you are newer to software development, it can be intimidating to participate in meetings. </p>
<p>You might also feel overwhelmed with some of the discussion and all of the new terminology being used in the meeting. Just try to ask questions and remember that it takes a while to understand all of the ins and outs for the software process. </p>
<p>My natural inclination is to be more reserved in meetings, but I have made more of an effort to speak up and ask questions on what I don't understand. Sometimes you will learn that other people had the same question and were glad that you asked that question. </p>
<p>Try your best to actively participate in meetings and share your input on the project and ask questions on what you need help with. </p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>As you can see, there are a lot of components to building out software products. Your days won't be spent writing code 8 hours straight. </p>
<p>Instead, your days will be filled with meetings, pair programing sessions, debugging code, reading documentation, writing documentation, and testing software. </p>
<p>I hope you enjoyed this article and have a better understanding what it is like to be a software developer. Best of luck on your software journey. </p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
