<?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: Santiago Correa</title>
    <description>The latest articles on DEV Community by Santiago Correa (@scorreaui).</description>
    <link>https://dev.to/scorreaui</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%2F604740%2F49a7db67-f029-49ea-a4bb-b845d1e89a87.png</url>
      <title>DEV Community: Santiago Correa</title>
      <link>https://dev.to/scorreaui</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/scorreaui"/>
    <language>en</language>
    <item>
      <title>I built "Never Schlafen"</title>
      <dc:creator>Santiago Correa</dc:creator>
      <pubDate>Sun, 11 Jan 2026 16:27:35 +0000</pubDate>
      <link>https://dev.to/scorreaui/i-built-never-schlafen-5763</link>
      <guid>https://dev.to/scorreaui/i-built-never-schlafen-5763</guid>
      <description>&lt;p&gt;Hey peeps,&lt;/p&gt;

&lt;p&gt;I built this site called Never Schlafen. It’s a simple utility that keeps your screen from going to sleep, but I added a few extras to make it more of an experience.&lt;/p&gt;

&lt;p&gt;Most wake-lock tools are just a button, but I wanted something that looks good on a second monitor or even in a different window while I'm focused on other things.&lt;/p&gt;

&lt;p&gt;What you can do with it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose from several animated themes (Cyber, Aurora, Fireplace, etc.).&lt;/li&gt;
&lt;li&gt;Listen to Lofi or paste your own YouTube links.&lt;/li&gt;
&lt;li&gt;Play some mini-games (Snake, Flappy Bird, Breakout) when you need a break.&lt;/li&gt;
&lt;li&gt;Hide everything except the background and a clock with Zen Mode.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s totally free and open for feedback. &lt;/p&gt;

&lt;p&gt;Check it out: &lt;a href="https://never-schlafen.online/" rel="noopener noreferrer"&gt;https://never-schlafen.online/&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Let me know what you think or if you have any theme ideas!&lt;/p&gt;

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

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

</description>
      <category>webdev</category>
      <category>showdev</category>
      <category>design</category>
      <category>programming</category>
    </item>
    <item>
      <title>Want a cool new theme for VS CODE?</title>
      <dc:creator>Santiago Correa</dc:creator>
      <pubDate>Thu, 13 May 2021 01:10:52 +0000</pubDate>
      <link>https://dev.to/scorreaui/want-a-cool-new-theme-for-vs-code-493</link>
      <guid>https://dev.to/scorreaui/want-a-cool-new-theme-for-vs-code-493</guid>
      <description>&lt;p&gt;Hey there,&lt;/p&gt;

&lt;p&gt;I'm just creating a simple short post for this, if you want to try a new theme I created and let me know what your thoughts are, that would be wonderful.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=Wegrix.wegrix"&gt;Theme&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>weeklyui</category>
      <category>theme</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Accessibility and testing</title>
      <dc:creator>Santiago Correa</dc:creator>
      <pubDate>Sat, 17 Apr 2021 00:17:14 +0000</pubDate>
      <link>https://dev.to/scorreaui/accessibility-and-testing-4je3</link>
      <guid>https://dev.to/scorreaui/accessibility-and-testing-4je3</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclaimer: This is not going to tell you every single accessibility principle, but what you can start implementing or thinking about as soon as possible in terms of development.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can read about W3C accessibility principles &lt;a href="https://www.w3.org/WAI/fundamentals/accessibility-principles/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now to start off the article, I'm an accessibility lover! and I love to make all things accessible. This is the reason why I'm writing this article.&lt;/p&gt;

&lt;p&gt;Let's define what accessibility is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accessibility&lt;/strong&gt; is the practice of making your websites usable by as many people as possible according to MDN.&lt;/p&gt;

&lt;p&gt;There is a ton of information about accessibility and I can make this article super super long, but I'm not going to do that to make a couple concepts more digestible.&lt;/p&gt;

&lt;h1&gt;
  
  
  Quick tips for your accessible website
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Use semantic HTML
&lt;/h2&gt;

&lt;p&gt;For example, let's say we need an element to open a modal, which one do you think is the most correct semantic element to use?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;a class="c-modal__open"&amp;gt;Find out more&amp;lt;/a&amp;gt;
&amp;lt;div class="c-modal__open"&amp;gt;Find out more&amp;lt;/div&amp;gt;
&amp;lt;button class="c-modal__open"&amp;gt;Find out more&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The correct element would be a button, because of the following reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; tag is used to perform an action.&lt;/li&gt;
&lt;li&gt;Buttons are keyboard accessible.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why shouldn't you use an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag or &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; tag&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;An &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag should be used for navigation.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;tag is a generic container for flow content.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What if you need to navigate to another page, what would the correct element be?&lt;/p&gt;

&lt;p&gt;You got it, an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag because it should be used for navigation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keyboard Accessibility
&lt;/h2&gt;

&lt;p&gt;People with motor function impairments use the keyboard (or other non-mouse features) to activate website functionality.&lt;/p&gt;

&lt;p&gt;Let's go back to the modal example, I'm just going to mention one feature a modal should have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User should be able to close the modal through keyboard. Either be it by using the ESC button, tabbing through or clicking on a close button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If a user only used a keyboard or device that mocks a keyboard, they will be unable to exit the modal if you only implement click events.&lt;/p&gt;

&lt;p&gt;Also, here is an example of an &lt;a href="https://www.w3.org/TR/wai-aria-practices-1.1/examples/dialog-modal/dialog.html"&gt;accessible modal&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Text alternatives for non-text content
&lt;/h2&gt;

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

&lt;ul&gt;
&lt;li&gt;Short equivalents for images, including icons, buttons, and graphics.&lt;/li&gt;
&lt;li&gt;Description of data represented on charts, diagrams, and illustrations.&lt;/li&gt;
&lt;li&gt;Brief descriptions of non-text content such as audio and video files.&lt;/li&gt;
&lt;li&gt;Labels for form controls, input, and other user interface components.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Font
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Size &lt;a href="https://css-tricks.com/accessible-font-sizing-explained/"&gt;check more here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Color contrast&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Testing
&lt;/h2&gt;

&lt;p&gt;How can you test if your website is accessible, there are many tools, but some I use are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://wave.webaim.org/"&gt;Wave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.deque.com/axe/"&gt;Axe&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Browser DevTools ( Chrome )

&lt;ul&gt;
&lt;li&gt;Right Click &amp;gt; Lighthouse &amp;gt; Generate Report&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Built in screen readers ( Mac Screen Reader )&lt;/li&gt;
&lt;li&gt;ChromeVox &lt;a href="https://chrome.google.com/webstore/detail/screen-reader/kgejglhpjiefppelpmljglcjbhoiplfn"&gt;Screen Reader Extension&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://crossbrowsertesting.com/"&gt;Cross Browser testing&lt;/a&gt;, just to make sure same behavior is replicated everywhere&lt;/li&gt;
&lt;li&gt;Good old tabbing, enter, spacing and so on&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dequeuniversity.com/color-contrast"&gt;Color contrast checkers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also, just a general tip, validate your markup and styles.&lt;/p&gt;

&lt;p&gt;To validate HTML: &lt;a href="https://validator.w3.org/"&gt;https://validator.w3.org/&lt;/a&gt;&lt;br&gt;
To validate CSS: &lt;a href="http://jigsaw.w3.org/css-validator/"&gt;http://jigsaw.w3.org/css-validator/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For code organization, make sure you lint your code by using a linter.&lt;/p&gt;

&lt;p&gt;What is a linter? It is a static code analysis tool used to flag programming errors, bugs, stylistic errors and suspicious construct. &lt;/p&gt;

&lt;p&gt;Popular linter: ESLINT.&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use semantic HTML.&lt;/li&gt;
&lt;li&gt;Make sure your website is keyboard accessible.&lt;/li&gt;
&lt;li&gt;Add text alternatives.&lt;/li&gt;
&lt;li&gt;Question to ask: Is my font size readable for people with low vision or can this be adjusted?&lt;/li&gt;
&lt;li&gt;Test your website or other websites and check if it's accessible.&lt;/li&gt;
&lt;li&gt;Validate your HTML and CSS.&lt;/li&gt;
&lt;li&gt;Lint your code.&lt;/li&gt;
&lt;li&gt;There are so many resources (W3C, Google, MDN) and so on.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>devjournal</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>React Router  - Route ( WTF Moment )</title>
      <dc:creator>Santiago Correa</dc:creator>
      <pubDate>Fri, 16 Apr 2021 21:02:54 +0000</pubDate>
      <link>https://dev.to/scorreaui/react-router-route-wtf-moment-3102</link>
      <guid>https://dev.to/scorreaui/react-router-route-wtf-moment-3102</guid>
      <description>&lt;p&gt;Recently I was working on a project which consisted of books, and I realized that my whole web app was mounting and unmounting instead of the components re-rendering. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;More details:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The project consisted of 2 pages.&lt;/p&gt;

&lt;p&gt;Here's a quick wireframe I whipped up:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffxgbeeegbjcqi0gwe0l4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffxgbeeegbjcqi0gwe0l4.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Home&lt;/li&gt;
&lt;li&gt;Search&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I used react-router to create the navigation between pages.&lt;/p&gt;

&lt;p&gt;What I didn't know, until I further read their documentation, is that if you use the prop component in &lt;code&gt;&amp;lt;Route&amp;gt;&lt;/code&gt; it uses React.createElement to create a new React element from the given component.&lt;/p&gt;

&lt;p&gt;That means if you provide an inline function to the component prop, you would create a new component every render. This results in the existing component unmounting and the new component mounting instead of just updating the existing component. &lt;/p&gt;

&lt;p&gt;This caused undesired behavior which was when I was on the search page and updated the App state it would refresh everything and I would lose the state I had in the Search page. &lt;/p&gt;

&lt;p&gt;Instead, to just make sure the component updates and doesn't mount and unmount when there is an update, &lt;strong&gt;use render&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Route
  path='/'
  exact
  render={() =&amp;gt; ( 
   &amp;lt;Home 
    currentlyReading={this.state.currentlyReading} 
    read={this.state.read}
    wantToRead={this.state.wantToRead}
    updateBookShelf={(book, shelf) =&amp;gt; 
    this.updateBookShelf(book, shelf)} /&amp;gt;
  )}
&amp;gt;&amp;lt;/Route&amp;gt;               
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Route
  path='/'
  exact
  render={() =&amp;gt; ( 
   &amp;lt;Search 
    allBooks={this.state.books}
    updateBookShelf={(book, shelf) =&amp;gt; 
    this.updateBookShelf(book, shelf)} /&amp;gt;
  )}
&amp;gt;&amp;lt;/Route&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Component unmounts and mounts a new component.&lt;/li&gt;
&lt;li&gt;Render updates components, instead of unmounting and mounting.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>lesson</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>JavaScript Scope</title>
      <dc:creator>Santiago Correa</dc:creator>
      <pubDate>Mon, 12 Apr 2021 01:45:18 +0000</pubDate>
      <link>https://dev.to/scorreaui/javascript-scope-e45</link>
      <guid>https://dev.to/scorreaui/javascript-scope-e45</guid>
      <description>&lt;p&gt;Scope in a programming language controls the visibility and lifetime of variables and parameters.  &lt;/p&gt;

&lt;p&gt;Another way of thinking about scope: The part of the program where a particular identifier is visible or accessible such as a variable or function name.&lt;/p&gt;

&lt;p&gt;Why am I ranting about scope, well..., it's because of the following reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Security. Variables can only be accessed from a certain area of the program.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reduces naming collision. We can use the same variable name in different scopes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bugs. We all love bugs or do we? Getting to know a little bit more about scope will help you understand variable values or issues.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before I get in to examples, we have to know what types of scope exist:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Global&lt;/li&gt;
&lt;li&gt;Function&lt;/li&gt;
&lt;li&gt;Block&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Global&lt;/strong&gt;&lt;br&gt;
Any variable that is not inside a function or block ( a pair of curly braces ) is inside the global scope.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Function&lt;/strong&gt;&lt;br&gt;
Any variable that is declared inside a function can only be accessed within that function, that means you cannot access them from outside it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Block&lt;/strong&gt;&lt;br&gt;
ES6 introduced let and const variables, unlike var, they can be scoped to the nearest pair of curly braces. That means they can't be accessed outside that pair.&lt;/p&gt;

&lt;p&gt;Finally, how does JavaScript find the variable value.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check current scope&lt;/li&gt;
&lt;li&gt;Check outer scope&lt;/li&gt;
&lt;li&gt;Check global scope&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If it's still not able to find the variable, it will either implicitly declare the variable in the global scope or return an error. &lt;/p&gt;

&lt;p&gt;Time for examples:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Global&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var meow = 'Meow';

function cat () {
 return meow
}

// value returned by cat is 'Meow'
cat()

console.log(meow) // Prints 'Meow'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, the variable meow will not return an error since it is in the global scope and is accessible everywhere since it is not function scoped or block scoped.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Function&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function cat () {
  var meow = 'Meow';
  return meow
}

// value returned by cat is 'Meow'
cat()

console.log(meow) // Uncaught ReferenceError: meow is not defined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we try to access meow outside of cat it will return a &lt;code&gt;Uncaught ReferenceError: meow is not defined&lt;/code&gt; since meow is only accessible or visible in the function cat.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Block&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if(true) {
  const cat = 'meow';
  var meow = 'Meowwwww!!!!';
  console.log(cat); // Prints 'meow'
}

console.log(cat); // Uncaught ReferenceError: cat is not defined

console.log(meow); // Prints 'Meowwwww!!!!'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, what is going on here, the variable cat is bound to the if statement because of the curly braces or block scope. &lt;/p&gt;

&lt;p&gt;In this case the variable cat if accessed outside the if statement will return an error as defined above but since meow is not block scoped it will return the expected value. Remember const and let variables are block scoped.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A scope is an area where a variable is visible and accessible. &lt;/li&gt;
&lt;li&gt;Just like functions, scopes in JavaScript can be nested and the JavaScript engine traverses the scope chain ( how JavaScript looks for the variable ) to find the variables used in the program.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>scope</category>
    </item>
    <item>
      <title>JavaScript Hoisting</title>
      <dc:creator>Santiago Correa</dc:creator>
      <pubDate>Sun, 11 Apr 2021 02:58:16 +0000</pubDate>
      <link>https://dev.to/scorreaui/javascript-hoisting-525l</link>
      <guid>https://dev.to/scorreaui/javascript-hoisting-525l</guid>
      <description>&lt;p&gt;JavaScript before executing your code parses it, and adds every function and variable declarations it finds to its own memory. This is called hoisting.&lt;/p&gt;

&lt;p&gt;There are some different behaviors that occur when using a  function declaration vs a function expression.&lt;/p&gt;

&lt;p&gt;With function declarations, we can call a function before it’s defined, and our code will work. In the other case, we’ll have errors.&lt;/p&gt;

&lt;p&gt;A general rule of thumb is to always define functions, variables, objects and classes before using them.&lt;/p&gt;

&lt;p&gt;Suppose we have a function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function cat() {
  alert("I'm a cat that meows!")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Due to hoisting, we can invoke cat() before it is declared:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat()
function cat() {
  alert("I'm a cat that meows!")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This only happens with functions and not function expressions.&lt;/p&gt;

&lt;p&gt;When you assign a function to a variable, that is a function expression:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat()
var cat = function() {
  alert("I'm a cat that meows!")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, the var declaration is hoisted and initialized with undefined as a value, something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var cat = undefined
cat()
cat = function() {
  alert("I'm a cat that meows!")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running this code will give you a &lt;code&gt;TypeError: cat is not a function error.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;const and let declarations are hoisted, too, but they are not initialized to undefined like var.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const cat = function cat() {
  alert("I'm a cat that meows!")
}

const cat = function () {
  alert("I'm a cat that meows!")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let cat = function cat() {
  alert("I'm a cat that meows!")
}

let cat = function () {
  alert("I'm a cat that meows!")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, if you invoke cat() before declaring it, it will give you a ReferenceError: 'cat' is not defined error.&lt;/p&gt;

&lt;p&gt;The same will happen for any other expression that assigns an object or class to a variable&lt;/p&gt;

&lt;p&gt;Class declarations work like let and const declarations: they are hoisted, but not initialized, and using a class before its declaration will give a ReferenceError:  is not defined error.&lt;/p&gt;

&lt;p&gt;A simple tip: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If you are not re-assigning a variable value, it's better to use const, otherwise use let. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't do it&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const meow = 'meow'
meow = 'meow, Angry cat!!! 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will not work - It will give you a &lt;code&gt;SyntaxError: Invalid or unexpected token&lt;/code&gt;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let meow = 'meow'
meow = 'meow, Angry cat!!! 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Summary:&lt;/p&gt;

&lt;p&gt;All function declarations are hoisted to the top of the current scope before any Javascript is executed.&lt;/p&gt;

&lt;p&gt;We can call a function declaration before it’s defined, and our code will work. &lt;/p&gt;

&lt;p&gt;function expressions are hoisted and initialized with undefined as a value, so this will give you an error.&lt;/p&gt;

&lt;p&gt;If you are not re-assigning a variable value, it's better to use const, otherwise use let. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>hoisting</category>
      <category>functional</category>
      <category>intro</category>
    </item>
    <item>
      <title>Core web vitals</title>
      <dc:creator>Santiago Correa</dc:creator>
      <pubDate>Sun, 28 Mar 2021 22:51:56 +0000</pubDate>
      <link>https://dev.to/scorreaui/core-web-vitals-5a2j</link>
      <guid>https://dev.to/scorreaui/core-web-vitals-5a2j</guid>
      <description>&lt;p&gt;In 2020 the Core Web Vitals are three metrics: Largest Contentful Paint (LCP), First Input Delay (FID), and Cumulative Layout Shift (CLS). &lt;/p&gt;

&lt;p&gt;Each metric measures a different aspect of user experience: &lt;strong&gt;LCP&lt;/strong&gt; measures perceived load speed and marks the point in the page load timeline when the page's main content has likely loaded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FID&lt;/strong&gt; measures responsiveness and quantifies the experience users feel when trying to first interact with the page; and &lt;strong&gt;CLS&lt;/strong&gt; measures visual stability and quantifies the amount of unexpected layout shift of visible page content.&lt;/p&gt;

&lt;p&gt;Each Core Web Vitals metric has associated thresholds, which categorize performance as either "good", "needs improvement", or "poor"&lt;/p&gt;

&lt;p&gt;Largest Contentful Paint: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Good: &amp;lt;2500ms&lt;/li&gt;
&lt;li&gt;Poor: &amp;gt;4000ms&lt;/li&gt;
&lt;li&gt;Percentile: 75&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First Input Delay:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Good: &amp;lt;100ms&lt;/li&gt;
&lt;li&gt;Poor: &amp;gt;300ms&lt;/li&gt;
&lt;li&gt;Percentile: 75&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cumulative Layout Shift:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Good: &amp;lt;0.1&lt;/li&gt;
&lt;li&gt;Poor: &amp;gt;0.25&lt;/li&gt;
&lt;li&gt;Percentile: 75&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, to classify the overall performance of a page or site, google uses the 75th percentile value of all page views to that page or site. In other words, if at least 75 percent of page views to a site meet the "good" threshold, the site is classified as having "good" performance for that metric. Conversely, if at least 25 percent of page views meet the "poor" threshold, the site is classified as having "poor" performance. So, for example, a 75th percentile LCP of 2 seconds is classified as "good", while a 75th percentile LCP of 5 seconds is classified as "poor".&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
