<?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: Mehdi Aoussiad</title>
    <description>The latest articles on DEV Community by Mehdi Aoussiad (@aoussiadmehdi).</description>
    <link>https://dev.to/aoussiadmehdi</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%2F390331%2Fcdd5b0e7-96bf-4714-9da4-77a13a31dd2e.jpg</url>
      <title>DEV Community: Mehdi Aoussiad</title>
      <link>https://dev.to/aoussiadmehdi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aoussiadmehdi"/>
    <language>en</language>
    <item>
      <title>How to Build a Professional Website with Squarespace</title>
      <dc:creator>Mehdi Aoussiad</dc:creator>
      <pubDate>Mon, 10 Feb 2025 22:26:18 +0000</pubDate>
      <link>https://dev.to/aoussiadmehdi/how-to-build-a-professional-website-with-squarespace-b5f</link>
      <guid>https://dev.to/aoussiadmehdi/how-to-build-a-professional-website-with-squarespace-b5f</guid>
      <description>&lt;p&gt;Creating a professional website can feel overwhelming, especially if you don’t have coding experience. Thankfully, platforms like Squarespace make it easier than ever to design stunning websites without writing a single line of code. In this post, I’ll guide you through the process and share tips to make your site stand out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Choose Squarespace?
&lt;/h2&gt;

&lt;p&gt;Squarespace is an all-in-one website builder that provides elegant templates, built-in SEO tools, and a user-friendly interface. Whether you’re starting a blog, an online store, or a portfolio, Squarespace offers everything you need.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key benefits:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Drag-and-drop builder&lt;/strong&gt; – No coding skills required
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Beautiful templates&lt;/strong&gt; – Professionally designed themes for various industries
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SEO optimization&lt;/strong&gt; – Built-in tools to improve your search rankings
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reliable hosting&lt;/strong&gt; – Secure and fast website performance
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step-by-Step Guide to Building Your Website
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Choose the Right Template
&lt;/h3&gt;

&lt;p&gt;Start by selecting a template that fits your brand or business. Squarespace offers customizable templates categorized by industry, making it easy to find one that suits your needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Customize Your Design
&lt;/h3&gt;

&lt;p&gt;Use the drag-and-drop editor to personalize your site. Modify fonts, colors, and layout elements to match your brand identity.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Add Essential Pages
&lt;/h3&gt;

&lt;p&gt;Ensure your website has key pages like:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Home&lt;/strong&gt; – A welcoming page that summarizes your offerings
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;About&lt;/strong&gt; – Introduce yourself or your business
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Services/Products&lt;/strong&gt; – Showcase what you offer
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blog (Optional)&lt;/strong&gt; – Share valuable content to attract visitors
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contact&lt;/strong&gt; – Make it easy for people to reach you
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Optimize for SEO
&lt;/h3&gt;

&lt;p&gt;SEO is crucial for driving organic traffic. Implement these best practices:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use relevant keywords in your content
&lt;/li&gt;
&lt;li&gt;Optimize images with alt text
&lt;/li&gt;
&lt;li&gt;Enable SSL for security
&lt;/li&gt;
&lt;li&gt;Set up meta descriptions for each page
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more SEO tips, check out my detailed guide on &lt;em&gt;&lt;a href="https://mehdiaoussiad.com/is-squarespace-good-for-seo/" rel="noopener noreferrer"&gt;Is Squarespace Good for SEO?&lt;/a&gt;&lt;/em&gt;  &lt;/p&gt;

&lt;h3&gt;
  
  
  5. Connect a Custom Domain
&lt;/h3&gt;

&lt;p&gt;A custom domain gives your website a professional look. Squarespace allows you to purchase a domain directly or connect an existing one.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Launch and Promote Your Website
&lt;/h3&gt;

&lt;p&gt;Before launching, preview your site and test it on different devices. Once live, promote it through social media, email marketing, and content creation.&lt;/p&gt;

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

&lt;p&gt;Squarespace is an excellent choice for anyone looking to build a professional website without coding. With its intuitive tools and powerful features, you can create a stunning online presence in no time.&lt;/p&gt;

&lt;p&gt;If you’re interested in more Squarespace tips and tutorials, visit my blog at &lt;a href="https://mehdiaoussiad.com" rel="noopener noreferrer"&gt;MehdiAoussiad.com&lt;/a&gt;.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.mehdiaoussiad.com/blog/squarespace-business-vs-personal" rel="noopener noreferrer"&gt;Squarespace Business vs Personal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mehdiaoussiad.com/blog/is-squarespace-good-for-small-business" rel="noopener noreferrer"&gt;Is Squarespace Good for Small Business&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mehdiaoussiad.com/blog/is-squarespace-good-for-seo" rel="noopener noreferrer"&gt;Is Squarespace Good for SEO&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mehdiaoussiad.com/blog/squarespace-real-estate-website-examples" rel="noopener noreferrer"&gt;Squarespace Real Estate Website Examples&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mehdiaoussiad.com/blog/squarespace-vs-bluehost" rel="noopener noreferrer"&gt;Squarespace vs Bluehost&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Have any questions? Drop them in the comments below!&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Digital Clock Using HTML CSS and JavaScript</title>
      <dc:creator>Mehdi Aoussiad</dc:creator>
      <pubDate>Fri, 09 Apr 2021 03:00:50 +0000</pubDate>
      <link>https://dev.to/aoussiadmehdi/digital-clock-using-html-css-and-javascript-2ak3</link>
      <guid>https://dev.to/aoussiadmehdi/digital-clock-using-html-css-and-javascript-2ak3</guid>
      <description>&lt;p&gt;This article was originally published on my blog &lt;a href="https://webdevidea.com/blog/javascript-digital-clock/"&gt;WebDevIdea&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Building a digital clock is a good idea if you want to improve your JavaScript skills as a beginner. You will learn a lot about how to use JavaScript dates and timing functions. So this is a very useful project for beginners.&lt;/p&gt;

&lt;p&gt;It was one of the projects that I have tried in my 100 days of code challenge. Honestly, It's easy to build a digital clock, you just need some HTML/CSS basics and of course a little bit of JavaScript, especially date methods and manipulating the DOM.&lt;/p&gt;

&lt;p&gt;In this article, we will use HTML CSS and vanilla JavaScript in order to build a simple real-time digital clock. So let's get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  The HTML Code
&lt;/h2&gt;

&lt;p&gt;When it comes to HTML code, it's very simple. We just need one div that contains a heading where we will display the time in hours, minutes, and seconds using JavaScript.&lt;/p&gt;

&lt;p&gt;Here is the code example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"parent"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
 &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, that's all we need in HTML. For the heading &lt;code&gt;h1&lt;/code&gt;, we will leave it empty because we will use JavaScript later to display the time on it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The JavaScript logic
&lt;/h2&gt;

&lt;p&gt;Now we will use JavaScript to display an updated time in hours, minutes, and seconds. We will also add a simple animation for our digital clock.&lt;br&gt;
Firstly, let's select our HTML elements:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Selecting The HTML elements.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;parentDiv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.parent&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;h1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;h1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, we will create a function called &lt;code&gt;digitalClock&lt;/code&gt;. Inside that function, we will access the Date object to get the time in hours, minutes, and seconds.&lt;br&gt;
Here is the example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;digitalClock&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dateObj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;hours&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;dateObj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getHours&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;minutes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;dateObj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getMinutes&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;secondes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;dateObj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getSeconds&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;//Adding a zero to the left of the time if it's less or equal to 9.&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;hours&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="nx"&gt;hours&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`0&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;minutes&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="nx"&gt;minutes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`0&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;minutes&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;secondes&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="nx"&gt;secondes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`0&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;secondes&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//display the time on the h1 element.&lt;/span&gt;
 &lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;minutes&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;secondes&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;//Toggling the animate class.&lt;/span&gt;
&lt;span class="nx"&gt;parentDiv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;animate&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above, we added the time to the h1 with the property &lt;code&gt;innerHTML&lt;/code&gt;. In addition to that,  we have also toggled the class &lt;code&gt;animate&lt;/code&gt; that we have created in CSS in order to create an animation that changes the color of the clock’s border.&lt;/p&gt;

&lt;p&gt;Now in order to have a real-time clock that updates the time every second, we will need to use &lt;code&gt;setInterval&lt;/code&gt; in order to execute the function &lt;code&gt;digitalClock&lt;/code&gt; every 1000 milliseconds(1 second). As a result, the time will get updated every 1 second.&lt;br&gt;
Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;setInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;digitalClock&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The CSS part
&lt;/h2&gt;

&lt;p&gt;After adding JavaScript, the clock is functional now. We just need to add some styling to it.&lt;br&gt;
Read the CSS code below to see our stylesheet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;box-sizing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;border-box&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;36&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;35&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;35&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;63&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;252&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;63&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.parent&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;400px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;400px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;22&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="nb"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;63&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;252&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;63&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;/* Creating the class for our animation. */&lt;/span&gt;
&lt;span class="nc"&gt;.animate&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="nb"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;245&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;39&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;/*the time styles*/&lt;/span&gt;
&lt;span class="nc"&gt;.parent&lt;/span&gt; &lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;900&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;60px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. We built a simple digital clock using HTML CSS and JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript Clock
&lt;/h2&gt;

&lt;p&gt;Here is a Codepen example of the &lt;a href="https://codepen.io/MehdiAoussiad/full/BaLVpab?editors=1010"&gt;Project Demo&lt;/a&gt; to check it out.&lt;/p&gt;

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

&lt;p&gt;As you can see, building a clock is not difficult. Also, if you practice a lot, you will definitely get better because practice is what makes the perfect. It's the only to grow and become a good developer.&lt;br&gt;
Thank you for reading this article.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>html</category>
      <category>css</category>
    </item>
    <item>
      <title>Difference Between some() and every() in JavaScript</title>
      <dc:creator>Mehdi Aoussiad</dc:creator>
      <pubDate>Sun, 28 Mar 2021 03:06:47 +0000</pubDate>
      <link>https://dev.to/aoussiadmehdi/difference-between-some-and-every-in-javascript-2p0g</link>
      <guid>https://dev.to/aoussiadmehdi/difference-between-some-and-every-in-javascript-2p0g</guid>
      <description>&lt;p&gt;This article is originally published at &lt;a href="https://webdevidea.com/blog/some-vs-every-in-javascript/"&gt;WebDevIdea&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;JavaScript has a lot of useful methods that we can use to easily work with arrays. These JavaScript methods are called higher-order functions. So keep in mind that any function that takes another function as its argument is called a higher-order function.&lt;/p&gt;

&lt;p&gt;In this article, we will learn about the two higher-order functions &lt;code&gt;some()&lt;/code&gt; and &lt;code&gt;every()&lt;/code&gt; by covering the differences between them. Let’s get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  The some method
&lt;/h2&gt;

&lt;p&gt;The higher-order function &lt;code&gt;some()&lt;/code&gt; in JavaScript is used with arrays. It checks if any element in the array passes a test that we provide. If an element in the array passes the test, it returns &lt;code&gt;true&lt;/code&gt;. If none of the elements passes the test, it returns &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The method &lt;code&gt;some()&lt;/code&gt; takes a callback function as its argument. The callback function itself takes three arguments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The array element(required).&lt;/li&gt;
&lt;li&gt;The element index(optional).&lt;/li&gt;
&lt;li&gt;The array itself(optional).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s have a look at a practical example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let numbers = [6, 7, 8, 9, 10];

//Using ES5 syntax.
numbers.some(function(number){
  return number &amp;gt; 8;
}); 
// returns true.

//Using ES6 syntax.
numbers.some(number =&amp;gt; number &amp;gt; 8);
// returns true.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see above, the method &lt;code&gt;some()&lt;/code&gt; here checks if any number in the array is greater than 8. That's true because we have 9 which is greater than 8. That's why the method &lt;code&gt;some()&lt;/code&gt; returns true.&lt;/p&gt;

&lt;p&gt;So the higher-order function &lt;code&gt;some()&lt;/code&gt; iterates through each element in the array until it finds the one that passes the test(greater than 8), then it returns true. If none of the array elements is greater than 8, it will return false.&lt;/p&gt;

&lt;p&gt;In addition to that, the method &lt;code&gt;some()&lt;/code&gt; does not change the original array &lt;code&gt;numbers&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(numbers); 
// output: [6, 7, 8, 9, 10]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is another example that returns &lt;code&gt;false&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let numbers = [6, 7, 8, 9, 10];
numbers.some(function(number){
  return number &amp;lt; 6;
}); 
// returns false.

numbers.some(number =&amp;gt; number &amp;lt; 6);
// returns false.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The every method
&lt;/h2&gt;

&lt;p&gt;The method &lt;code&gt;every()&lt;/code&gt; is also used with arrays in JavaScript. It checks if all elements in the array pass a test that we provide. If all elements in the array pass the test, it returns &lt;code&gt;true&lt;/code&gt;. If at least one element didn't pass the test, it returns &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The method &lt;code&gt;every()&lt;/code&gt; also takes a callback function as its argument. The callback function itself takes three arguments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The array element(required).&lt;/li&gt;
&lt;li&gt;The element index(optional).&lt;/li&gt;
&lt;li&gt;The array itself(optional).
Have a look at the code example below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let numbers = [6, 7, 8, 9, 10];

//Using ES5 syntax.
numbers.every(function(number){
  return number &amp;gt;= 6;
}); 
// returns true.

//Using ES6 syntax.
numbers.every(number =&amp;gt; number &amp;gt;= 6);
// returns true.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above, the method &lt;code&gt;every()&lt;/code&gt; checks if every number in the array of numbers is greater than or equal to 6. Because all the numbers in the array &lt;code&gt;numbers&lt;/code&gt; are greater than or equal to 6, the function returns &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So the higher-order function &lt;code&gt;some()&lt;/code&gt; iterates through each element in the array. If at least one element is not greater than or equal to 6, it will return &lt;code&gt;false&lt;/code&gt;. But if all the array elements pass the test, it will return &lt;code&gt;true&lt;/code&gt;.&lt;br&gt;
In addition to that, the method &lt;code&gt;every()&lt;/code&gt; also does not change the original array &lt;code&gt;numbers&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(numbers); 
// output: [6, 7, 8, 9, 10]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is another example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let names = ['John', 'John', 'Mehdi', 'John'];

//ES5 syntax.
names.every(function(name){
  return name === 'John';
}); 
// returns false.

//ES6 syntax.
names.every(name =&amp;gt; name === 'John');
// returns false.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see above, we used the method &lt;code&gt;every()&lt;/code&gt; to check if all the array elements have the name of &lt;code&gt;John&lt;/code&gt;.&lt;br&gt;
Since we have another name &lt;code&gt;Mehdi&lt;/code&gt; in the names array, the function returns &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;

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

&lt;p&gt;&lt;code&gt;some()&lt;/code&gt; and &lt;code&gt;every()&lt;/code&gt; are two useful array methods that you should know in JavaScript. The first one checks if any element in the array passes a test function. On the other hand, the second one(every) checks if all the elements in the array pass the test function. So that's the only difference between these two higher-order functions in JavaScript.&lt;/p&gt;

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