<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: May</title>
    <description>The latest articles on DEV Community by May (@meyruiz).</description>
    <link>https://dev.to/meyruiz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F192606%2Fc6a89433-d6e0-4fdc-ad18-72e58b4e13ac.JPG</url>
      <title>DEV Community: May</title>
      <link>https://dev.to/meyruiz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/meyruiz"/>
    <language>en</language>
    <item>
      <title>How to keep a healthy package.json</title>
      <dc:creator>May</dc:creator>
      <pubDate>Sun, 08 Jan 2023 19:42:05 +0000</pubDate>
      <link>https://dev.to/meyruiz/how-to-keep-a-healthy-packagejson-55pe</link>
      <guid>https://dev.to/meyruiz/how-to-keep-a-healthy-packagejson-55pe</guid>
      <description>&lt;p&gt;It is common for developers to add npm packages in their applications without knowing what is going on behind the curtains, while also following other bad package.json practices. It is understandable, most of us work in fast-paced environments where we have strict dates to deliver new functionality for our clients. However, as developers, we might face security concerns if we undermine the risk of adding a new npm package, and we should also at the same time keep a healthy package.json. In this article you will learn about the main concerns about npm package management and what we can do to avoid them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Avoid trivial packages&lt;/strong&gt;&lt;br&gt;
 &lt;br&gt;
A trivial package is a package that does functionality that a developer can easily code themselves. Trivial packages are common, a study found that &lt;a href="https://dl.acm.org/doi/10.1145/3106237.3106267"&gt;trivial packages make up 16.8% of their studied npm packages&lt;/a&gt;. Trivial packages are used because they are perceived to be well tested implementations of code, however only 45.2% of trivial packages even have tests.&lt;br&gt;
 &lt;br&gt;
This data is concerning considering the risk one takes when adding a new package who can be exploited. One example where adding a trivial package went wrong is the left-pad package. On 22 March 2016 its creator, Azer Koçulu, &lt;a href="https://qz.com/646467/how-one-programmer-broke-the-internet-by-deleting-a-tiny-piece-of-code"&gt;decided to unpublish several of his packages in npm, including left-pad&lt;/a&gt;. This led to thousands of applications breaking - even high-profile applications like React, Babel and Node. This package consisted of roughly 11 lines of code.&lt;/p&gt;

&lt;p&gt;Tip: When adding a new package to your project, analyze the cost-benefit and evaluate if you can develop the same functionality yourself without impacting the timeline of the project. Each new package is a new potential point of failure, so it is wise to minimize failures as much as possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Use SemVer&lt;/strong&gt;&lt;br&gt;
 &lt;br&gt;
To keep a healthy package.json, first we need to take a look at Semantic Versioning, or &lt;a href="https://semver.org/"&gt;SemVer&lt;/a&gt;. Below is a chart given by npm explaining how SemVer works:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz52z9yvuc5nalicgyufd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz52z9yvuc5nalicgyufd.png" alt="SemVer Rules" width="800" height="485"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Basically, we start our product release version with 1.0.0. Then, the next release version number depends on the type of changes that we introduce. &lt;br&gt;
 &lt;br&gt;
Tip: It's recommended to use caret (^) to accept minor and patch updates, and tilde (~) to accept patch releases only. Depending on your project's needs, you may use these restrictions to limit the version of the package your project will use. Check &lt;a href="https://devhints.io/semver"&gt;SemVer cheatsheet&lt;/a&gt; for more information.&lt;br&gt;
 &lt;br&gt;
If we follow SemVer, we can handle major updates manually which are more likely to break our code. If you're not sure if you're following SemVer ranges correctly check the &lt;a href="https://semver.npmjs.com/"&gt;SemVer calculator&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Avoid pinning dependencies&lt;/strong&gt;&lt;br&gt;
 &lt;br&gt;
Pinned dependencies are packages which are fixed package versions. This is not recommended since the package will not get latest updates.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"dependencies": {
    "react": "16.8.6"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;br&gt;
&lt;strong&gt;4. Avoid adding git repositories as packages&lt;/strong&gt;&lt;br&gt;
 &lt;br&gt;
There is a way of adding git repositories as packages, but this should be mostly used as a last resort (for example, when the package doesn't exist in npm). If this repository is deleted or updated, you might face major issues.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"dependencies": {
    "react": "facebook/react"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Look up the package overall health&lt;/strong&gt;&lt;br&gt;
 &lt;br&gt;
A package health can be defined by three questions: &lt;br&gt;
 &lt;br&gt;
 - Is this package actively maintained?&lt;br&gt;
 - How many developers use it?&lt;br&gt;
 - Which are the known security issues?&lt;br&gt;
 &lt;br&gt;
All this information can be found in GitHub, you can also look at the npm weekly downloads of the particular package you have chosen to see how frequently it is used among the dev community. There is also the Snyk Advisor tool, which shows all this information in a very friendly UI: &lt;a href="https://snyk.io/advisor/"&gt;https://snyk.io/advisor/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76qiribqbd7y5fxwx7bl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76qiribqbd7y5fxwx7bl.png" alt="Snyk Advisor package health score" width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Package management sounds a bit complex, and every team approaches it differently. I hope these points have given you an insight on the most important things to keep in mind to maintain a healthy package.json. There is no perfect way of handling it, but when we know the most common points of failure, we can avoid security risks and keep our application working.&lt;/p&gt;

&lt;p&gt;In this article my goal was to give an overview of the most common tasks we can do to manage our npm packages, if you wish to go more in depth I recommend reading  Karen De Graaf's article &lt;a href="https://medium.com/openclassrooms-product-design-and-engineering/guide-to-managing-npm-packages-in-your-package-json-d315fe2ccab0"&gt;"Guide to managing npm packages in your package.json"&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;References: &lt;br&gt;
Rabe Abdalkareem, Olivier Nourry, Sultan Wehaibi, Suhaib Mujahid, and Emad Shihab. 2017. Why do developers use trivial packages? an empirical case study on npm. In Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering (ESEC/FSE 2017). Association for Computing Machinery, New York, NY, USA, 385–395. &lt;a href="https://doi.org/10.1145/3106237.3106267"&gt;https://doi.org/10.1145/3106237.3106267&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://qz.com/646467/how-one-programmer-broke-the-internet-by-deleting-a-tiny-piece-of-code"&gt;How one programmer broke the internet by deleting a tiny piece of code&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.theregister.com/2016/03/23/npm_left_pad_chaos/"&gt;How one developer just broke Node, Babel and thousands of projects in 11 lines of JavaScript&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>npm</category>
    </item>
    <item>
      <title>AWS Cloud Practitioner Journey - Resources</title>
      <dc:creator>May</dc:creator>
      <pubDate>Fri, 09 Apr 2021 22:04:56 +0000</pubDate>
      <link>https://dev.to/meyruiz/aws-cloud-practitioner-journey-4ak0</link>
      <guid>https://dev.to/meyruiz/aws-cloud-practitioner-journey-4ak0</guid>
      <description>&lt;p&gt;Cloud skills are becoming important in our roles as developers. One way to begin our path to learn about cloud computing is to take our first certification. The AWS Cloud Practitioner Certification is an optional step if you want to get an Associate or Specialty certification, but it's recommended since you get the exam experience while also validating your knowledge on the basics of AWS Cloud.&lt;/p&gt;

&lt;p&gt;Here is the &lt;a href="https://aws.amazon.com/certification/certified-cloud-practitioner/"&gt;Cloud Practitioner Official Description&lt;/a&gt;. Notice it is recommended to have around six months of experience using AWS - but it's not necessary, you might need to dedicate around a week or two to be prepared for the exam.&lt;/p&gt;

&lt;p&gt;What is important is actually getting experience practicing for the exam itself. My recommendation is to take a course covering all the contents of Cloud Practitioner certification and then get practice exams.&lt;/p&gt;

&lt;p&gt;For courses I recommend these: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.aws.training/Details/Curriculum?id=27076"&gt;AWS Cloud Practitioner Essentials&lt;/a&gt;&lt;br&gt;
This course is good for beginners and people with IT backgrounds as well. It gives explanations to every subject using videos and illustrations. At the end of each chapter you will be given a small quiz to test your knowledge.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=3hLmDS179YE"&gt;Freecodecamp - AWS Certified Cloud Practitioner Training 2020&lt;/a&gt;&lt;br&gt;
This course is a 4-hour in-depth video that covers everything you will encounter in the exam. It is less illustrative than AWS's training so I would recommend this video for people with an IT background and who need to cover the exam's content as soon as possible.&lt;/p&gt;

&lt;p&gt;Choose the course you like the most, and then move on to the practice exams. In my case, I used this &lt;a href="https://www.udemy.com/course/aws-certified-cloud-practitioner-practice-test/"&gt;Udemy course&lt;/a&gt; to study for the certification. &lt;/p&gt;

&lt;p&gt;In this course you are given 6 practice exams, you are able to take each exam as many times as you wish and you can review your correct/incorrect answers. Each question has detailed answer explanations, so it is recommended for you to review each incorrect answer on your practice exams so you can compare your previous knowledge and improve your score. &lt;/p&gt;

&lt;p&gt;The first time I did the exams I scored about 68% in each one of them. Just review the exam's answers and why the answer you thought was right is incorrect. The next time you take any of these exams you will score around 85%-90% ;) and you will be ready for your certification. &lt;/p&gt;

&lt;p&gt;I would say to do these exams every other day before your certification so you get an idea of which content you need to review.&lt;/p&gt;

&lt;p&gt;While I strongly recommend getting the Udemy course, you can also check these free resources:&lt;br&gt;
&lt;a href="https://d1.awsstatic.com/training-and-certification/docs-cloud-practitioner/AWS-Certified-Cloud-Practitioner_Sample-Questions.pdf"&gt;Official sample questions by AWS&lt;/a&gt; 10 example questions with answers&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=FXKE1SfityA"&gt;Youtube Practice Test&lt;/a&gt; This video is similar to the content you will get in Udemy tests, but mostly without explanations of the correct/incorrect answers. &lt;/p&gt;

&lt;p&gt;I hope these resources can help you on your cloud journey! :) If you already got your certification, feel free to comment on any other resource you found useful to study from.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Design Patterns for Web Development</title>
      <dc:creator>May</dc:creator>
      <pubDate>Tue, 03 Nov 2020 03:34:20 +0000</pubDate>
      <link>https://dev.to/meyruiz/design-patterns-for-frontend-developers-2ii3</link>
      <guid>https://dev.to/meyruiz/design-patterns-for-frontend-developers-2ii3</guid>
      <description>&lt;p&gt;There are times where building a design structure for your project might seem daunting when you don't know how to start. Knowing design patterns can help us as developers to find out how to better build our software depending on how scalable we will want it or the kind of functionality we need. &lt;/p&gt;

&lt;p&gt;Design patterns are typical solutions to common problems in software design. Rather than being a code solution, they are general concepts you can implement in your software to expect certain behavior from it. The book "Design Patterns: Elements of Reusable Object-Oriented Software", which has become a classic in software development, introduced 23 patterns to solve object-oriented design. Here I'm going to cover 3 design patterns which are some of the most used in front-end development.&lt;/p&gt;

&lt;p&gt;But first, why learning design patterns is so important?&lt;/p&gt;

&lt;p&gt;1.Recognize patterns in libraries and languages &lt;br&gt;
   Some libraries like Angular use design patterns in the way they are structured and the way they create solutions to problems. This gives us an idea of how we can use this current behavior to build our own solutions.&lt;/p&gt;

&lt;p&gt;2.Avoid reinventing the wheel&lt;/p&gt;

&lt;p&gt;It's easier to create solutions others have previously faced and succeeded in implementing them, than coming up with a solution from scratch.&lt;/p&gt;

&lt;p&gt;3.Shared vocabulary&lt;/p&gt;

&lt;p&gt;Within development teams, it's easier to talk about how to design your solutions if everyone in the team is familiarized with design patterns. It is easier to explain an abstract idea just by using its name rather than explaining the whole concept.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Patterns
&lt;/h3&gt;

&lt;p&gt;There are 3 types of design patterns depending on their behavior.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Creational patterns: Provide a structure to create objects easily, provide certain flexibility on its creation, and reuse existent code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Structural patterns: Provide a structure that helps assemble objects and classes into larger structures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Behavioral patterns:  Assign responsibilities between objects and take care of communication.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Singleton
&lt;/h3&gt;

&lt;p&gt;Singleton is a creational design pattern that restricts class to have only one instance, while also creating a global access point to this instance. It is used when control access to a shared resource is needed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use this pattern when you need to ensure control access to a resource that might return inconsistencies if it is changed by two different objects at the same time. (Ex. Databases, state of an object)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Singleton {
    private static instance: Singleton;

    private constructor() { }

    public static getInstance(): Singleton {
        if (!Singleton.instance) {
            Singleton.instance = new Singleton();
        }

        return Singleton.instance;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Observer
&lt;/h3&gt;

&lt;p&gt;Observer is a behavioral design pattern in which objects get information about any events happening to the object they are observing. The observer pattern defines a subscriber method, which will update every object that is subscribed to itself, making sure every subscriber gets the latest update.&lt;/p&gt;

&lt;p&gt;An example of an observer in our daily life would be subscribing to a newsletter. The moment you join the mailing list you are notified when there is a new publication.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use this pattern when changes on one object may require updating other objects, and the actual set of objects is unknown or changes dynamically.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Observable {

    // List of observers
    private observers: Observer[] = [];

    public attach(observer: Observer): void {
        const exists = this.observers.includes(observer);
        if (!exists) {
            this.observers.push(observer);
        }
    }

    public detach(observer: Observer): void {
        const observerIndex = this.observers.indexOf(observer);
        if (observerIndex !== -1) {
            this.observers.splice(observerIndex, 1);
        }
    }

    public notify(): void {
        for (const observer of this.observers) {
            observer.update(this);
        }
    }
}

class Observer {
    public update(observable: Observable): void {
        // Update observer according to Observable state
    }
}


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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Decorator
&lt;/h3&gt;

&lt;p&gt;Decorator is a structural pattern that lets you add new characteristics to objects by adding a wrapper that contains the behaviors.&lt;/p&gt;

&lt;p&gt;We can find examples of this pattern in food delivery apps where you can choose any toppings or extras to your food, then the application adds the corresponding cost to your order.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use this pattern when it's necessary to add these extra behaviors on run time, or when inheritance is not possible.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interface Coffee {
    getCost(): int;
}

class SimpleCoffee implements Coffee {
    public getCost(): int {
        return 2;
    }
}

class CoffeeDecorator implements Coffee {
    protected decoratedCoffee: SimpleCoffee;

    constructor(decoratedCoffee: SimpleCoffee) {
        this.decoratedCoffee = decoratedComponent;
    }

    public getCost(): int {
        return this.component.getCost();
    }
}

class WithMilk extends CoffeeDecorator {
    public getCost(): int {
        return super.getCost + 0.5;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though knowing these design patterns is useful to build better solutions, it is not always necessary to use them in every project we come across. We need to take some time to think about the pros and cons of implementing them on our own code. Remember to avoid overcomplicating your code if you will not get any benefit from using them in that particular case.&lt;/p&gt;

&lt;p&gt;Have you used any other design patterns in your web development projects? Let me know which are the ones you use the most.&lt;/p&gt;

&lt;p&gt;To learn more about design patterns check out:&lt;br&gt;
&lt;a href="https://refactoring.guru/design-patterns"&gt;Refractoring Guru - Design Patterns&lt;/a&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>7 Useful Features of Chrome DevTools</title>
      <dc:creator>May</dc:creator>
      <pubDate>Sat, 25 Jul 2020 21:35:18 +0000</pubDate>
      <link>https://dev.to/meyruiz/7-useful-features-of-chrome-devtools-3k5m</link>
      <guid>https://dev.to/meyruiz/7-useful-features-of-chrome-devtools-3k5m</guid>
      <description>&lt;h2&gt;
  
  
  Preserve Log
&lt;/h2&gt;

&lt;p&gt;Imagine you have a bug that causes a page to reload. Every time the bug gets triggered you lose all your logs and have no idea where to start debugging.&lt;/p&gt;

&lt;p&gt;This function maintains a record of logs in the Console even after reloading. Go to Settings and then check "Preserve Logs" to activate it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcl6n583rvpilo8ov6tq2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcl6n583rvpilo8ov6tq2.gif" alt="Alt Text" width="800" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Tip: Run Clear console (Ctrl + L or Cmd + K) when you’re done debugging.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Debug on DOM Modifications
&lt;/h2&gt;

&lt;p&gt;There are situations where you want to notice changes on a specific element to inspect what’s happening. To trigger a break when a DOM element changes, right-click on an element and then select one of the next:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Subtree modifications:&lt;/strong&gt; Breaks when a script modifies the selected element’s children.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Attribute modifications:&lt;/strong&gt; Breaks when an attribute is added to the selected element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Node removal:&lt;/strong&gt; Breaks when the selected element is removed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdzi8fl28f8zxah5szdq5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdzi8fl28f8zxah5szdq5.png" alt="Alt Text" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Screenshots
&lt;/h2&gt;

&lt;p&gt;Taking a screenshot using DevTools is quicker than opening an external application to capture your screen, especially when you can choose between capturing a selected area, full-size page, a specific node, or just your viewport.&lt;/p&gt;

&lt;p&gt;Access this menu using Ctrl + Shift + P (or Cmd + Shift + P in Mac), then type “Screenshot” and select your desired option. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvuhl92lv82kfrfv5w7tj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvuhl92lv82kfrfv5w7tj.png" alt="Alt Text" width="800" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Reference a selected element in the Console
&lt;/h2&gt;

&lt;p&gt;In the Elements tab, select an element you want to reference in the Console, then go back to the Console tab and type $0. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsss5q5b58t5hok8v7uhw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsss5q5b58t5hok8v7uhw.gif" alt="Alt Text" width="956" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Show Rendering
&lt;/h2&gt;

&lt;p&gt;It is helpful to look at what is rendering when we interact with our page, particularly when looking at performance issues. To highlight changes in the DOM we can go to Console, bring the tools bar using Ctrl + Shift + P (or Cmd + Shift + P in Mac) and then search for Show Rendering. Make sure to select the checkbox in the Rendering tab that activates Paint flashing. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx4dwi1fpnkxrlqfkeh5m.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx4dwi1fpnkxrlqfkeh5m.gif" alt="Alt Text" width="954" height="554"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Use Console Functions
&lt;/h2&gt;

&lt;p&gt;Sometimes we could overuse console.log() to debug when there might be other useful functions for specific purposes inside the Console class. &lt;/p&gt;

&lt;p&gt;For example, when logging an array of objects it can be useful to visualize this as a table. Use console.table() to visualize your data this way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7n88yedm3emfwpa80e1z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7n88yedm3emfwpa80e1z.png" alt="Alt Text" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;There are also different types of logs that we can use to prioritize issues like warning, error, and info.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8avbp05z6089qm96m8vu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8avbp05z6089qm96m8vu.png" alt="Alt Text" width="800" height="231"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;You can then use the dropdown “Default levels” next to the filter box to filter between different types of logs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjtqpmd6m1ju25jxp1ck3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjtqpmd6m1ju25jxp1ck3.png" alt="Alt Text" width="800" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  copy(object)
&lt;/h2&gt;

&lt;p&gt;This function allows you to copy anything into the clipboard. It is particularly useful when giving it a JSON object as it will copy a prettified version of your JSON into the clipboard. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq7zzupf2nqawv802p005.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq7zzupf2nqawv802p005.png" alt="Alt Text" width="800" height="888"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;You can also give this function an HTML element and it will copy it (and their children, if they do have any!)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flhkrmvy7ejt1j0pynefz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flhkrmvy7ejt1j0pynefz.png" alt="Alt Text" width="800" height="888"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;DevTools has many other options that can help your productivity, for more information check out &lt;a href="https://developers.google.com/web/tools/chrome-devtools"&gt;Chrome DevTools official documentation&lt;/a&gt; or &lt;a href="https://twitter.com/chromedevtools"&gt;Chrome DevTools Twitter account&lt;/a&gt; for new updates and tips. &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>chrome</category>
      <category>devtools</category>
      <category>debug</category>
    </item>
  </channel>
</rss>
