<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2026-05-31T13:04:04+00:00</updated><id>/feed.xml</id><title type="html">William Clark</title><subtitle>William &quot;Will&quot; Clark&apos;s GitHub Pages site: https://willcclark.github.io/</subtitle><entry><title type="html">Working with strings: [11 of 51]</title><link href="/2020/11/28/beginner-js-11.html" rel="alternate" type="text/html" title="Working with strings: [11 of 51]" /><published>2020-11-28T08:00:00+00:00</published><updated>2020-11-28T08:00:00+00:00</updated><id>/2020/11/28/beginner-js-11</id><content type="html" xml:base="/2020/11/28/beginner-js-11.html"><![CDATA[<p>Strings</p>
<ul>
  <li>The data type that represents textual elements on the web</li>
  <li>Could be anything from the output of <code class="language-plaintext highlighter-rouge">console.log</code> to text on a web page</li>
</ul>

<p>Concatenation</p>
<ul>
  <li>Used to format text before it reaches its final destination</li>
</ul>

<h2 id="what-is-string-concatenation">What is String Concatenation?</h2>
<p>Combining two or more strings</p>
<ul>
  <li>Feature that makes it easier to format text</li>
  <li>Can join a combination of variables and/or actual strings (also known as <em>string literals</em>)</li>
  <li>Concatenating strings will make a new string</li>
</ul>

<p>Done with a + operator</p>
<ul>
  <li>The addition operator is not just for numbers…</li>
</ul>

<h3 id="using-the--operator">Using the + operator</h3>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">let</span> <span class="nx">str1</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">Hello</span><span class="dl">"</span><span class="p">;</span>
<span class="kd">let</span> <span class="nx">str2</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">World!</span><span class="dl">"</span><span class="p">;</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">str1</span> <span class="o">+</span> <span class="nx">str2</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">str1</span> <span class="o">+</span> <span class="dl">"</span><span class="s2">Big</span><span class="dl">"</span> <span class="o">+</span> <span class="nx">str2</span><span class="p">)</span>
</code></pre></div></div>
<p>Output:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>HelloWorld!
HelloBigWorld
</code></pre></div></div>
<p>Adding spaces:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">let</span> <span class="nx">str1</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">Hello </span><span class="dl">"</span><span class="p">;</span>
<span class="kd">let</span> <span class="nx">str2</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">World!</span><span class="dl">"</span><span class="p">;</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">str1</span> <span class="o">+</span> <span class="nx">str2</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">str1</span> <span class="o">+</span> <span class="dl">"</span><span class="s2">Big </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">str2</span><span class="p">)</span>
</code></pre></div></div>
<p>Output:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Hello World!
Hello Big World!
</code></pre></div></div>

<h3 id="be-careful-with-numbers">Be careful with numbers!</h3>
<ul>
  <li>Numbers and strings both use the <em>+</em> operator</li>
  <li>Always keep everything the same data type</li>
</ul>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">let</span> <span class="nx">num1</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
<span class="kd">let</span> <span class="nx">num2</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">1</span><span class="dl">"</span><span class="p">;</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">num1</span> <span class="o">+</span> <span class="nx">num2</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="p">(</span><span class="nx">num1</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
</code></pre></div></div>
<p>Output:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>11
2
</code></pre></div></div>
<p><em>from: <a href="https://www.youtube.com/watch?v=dP1Er2BfVmo&amp;list=PLlrxD0HtieHhW0NCG7M536uHGOtJ95Ut2&amp;index=11">Working with strings [11 of 51] | Beginner’s Series to JavaScript</a></em></p>]]></content><author><name></name></author><summary type="html"><![CDATA[Strings The data type that represents textual elements on the web Could be anything from the output of console.log to text on a web page]]></summary></entry><entry><title type="html">Demo: Declaring variables [10 of 51]</title><link href="/2020/11/27/beginner-js-10.html" rel="alternate" type="text/html" title="Demo: Declaring variables [10 of 51]" /><published>2020-11-27T08:00:00+00:00</published><updated>2020-11-27T08:00:00+00:00</updated><id>/2020/11/27/beginner-js-10</id><content type="html" xml:base="/2020/11/27/beginner-js-10.html"><![CDATA[<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#!/usr/bin/env node
</span>
<span class="c1">// from &lt;https://youtu.be/EQMPAaAo6Fc&gt;</span>

<span class="c1">// remember, var is function-scoped.</span>
<span class="c1">// this file is essentially one function</span>
<span class="kd">var</span> <span class="nx">hello</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">Hello</span><span class="dl">"</span><span class="p">;</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">hello</span><span class="p">);</span>
<span class="nx">hello</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">Hello world</span><span class="dl">"</span><span class="p">;</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">hello</span><span class="p">);</span>

<span class="c1">// using let (block scoped)</span>
<span class="k">if</span> <span class="p">(</span><span class="kc">true</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">let</span> <span class="nx">world</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">Hello, World</span><span class="dl">"</span><span class="p">;</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">world</span><span class="p">);</span>
<span class="p">}</span>

<span class="c1">// const cannot be changed</span>
<span class="kd">const</span> <span class="nx">aaron</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">Aaron</span><span class="dl">"</span><span class="p">;</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">aaron</span><span class="p">);</span>
</code></pre></div></div>
<p><em>from <a href="https://youtu.be/EQMPAaAo6Fc">Demo: Declaring variables [10 of 51] | Beginner’s Series to JavaScript (YouTube)</a></em></p>]]></content><author><name></name></author><summary type="html"><![CDATA[```javascript #!/usr/bin/env node]]></summary></entry><entry><title type="html">Declaring variable: [9 of 51]</title><link href="/2020/11/26/beginner-js-9.html" rel="alternate" type="text/html" title="Declaring variable: [9 of 51]" /><published>2020-11-26T08:00:00+00:00</published><updated>2020-11-26T08:00:00+00:00</updated><id>/2020/11/26/beginner-js-9</id><content type="html" xml:base="/2020/11/26/beginner-js-9.html"><![CDATA[<ul>
  <li>Three ways to declare variables in JavaScript:
    <ul>
      <li><em>var</em></li>
      <li><em>let</em></li>
      <li><em>const</em></li>
      <li>For example:
        <div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  <span class="kd">var</span> <span class="nx">one</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
  <span class="kd">let</span> <span class="nx">two</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span>
  <span class="kd">const</span> <span class="nx">three</span> <span class="o">=</span> <span class="mi">3</span><span class="p">;</span>
</code></pre></div>        </div>
      </li>
    </ul>
  </li>
  <li>Each Keyword has its own purpose!
    <ul>
      <li><em>var</em>
        <ul>
          <li>Original way to declare variables in JavaScript</li>
          <li>A function scoped variable declaration, meaning that the variable, when defined, is available anywhere within that function.</li>
          <li>The variable is even available in the function before it was declared.</li>
          <li>The variable can be changed within the scope, meaning it is a immutable variable type. It can be reassigned, its data type can be changed</li>
        </ul>
      </li>
      <li><em>let</em>
        <ul>
          <li>Similar to var</li>
          <li>A block scoped variable declaration, meaning that the variable is only available within a block that has been denoted with a set of open and closed curly brackets</li>
          <li>can be changed in scope</li>
          <li>only usable after the declaration of the variable</li>
        </ul>
      </li>
      <li><em>const</em>
        <ul>
          <li>Block scoped, like let</li>
          <li>cannot be chaned</li>
          <li>when you have set a variable that you have defined as a <em>const</em>, meaning a constant value, you cannot change what that assignment is</li>
          <li>only available after declaration</li>
        </ul>
      </li>
    </ul>
  </li>
  <li>What to use when?
    <ul>
      <li><em>const</em> by default
        <ul>
          <li>use as the “go-to” variable declaration</li>
          <li>makes life easier for yourself and others when looking at your code, as it cannot be changed throughout the program and it will only have one value.</li>
          <li>lower chance for bugs</li>
        </ul>
      </li>
      <li><em>let</em> in loops
        <ul>
          <li>still very useful</li>
          <li>use inside of a block scope when it is desirable to create a new variable every time the loop happens.</li>
        </ul>
      </li>
      <li><em>var</em>
        <ul>
          <li>partially obselete, as <em>let</em> and <em>const</em> basically cover all of its use cases, and <em>let</em> and <em>const</em> remove some of the issues with using a <em>var</em> type variable declaration</li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

<p><em>from <a href="https://youtu.be/JNIXfGiDWM8?list=PLlrxD0HtieHhW0NCG7M536uHGOtJ95Ut2">Declaring variable: 9 of 51 (YouTube)</a></em></p>]]></content><author><name></name></author><summary type="html"><![CDATA[Three ways to declare variables in JavaScript: var let const For example: var one = 1; let two = 2; const three = 3; Each Keyword has its own purpose! var Original way to declare variables in JavaScript A function scoped variable declaration, meaning that the variable, when defined, is available anywhere within that function. The variable is even available in the function before it was declared. The variable can be changed within the scope, meaning it is a immutable variable type. It can be reassigned, its data type can be changed let Similar to var A block scoped variable declaration, meaning that the variable is only available within a block that has been denoted with a set of open and closed curly brackets can be changed in scope only usable after the declaration of the variable const Block scoped, like let cannot be chaned when you have set a variable that you have defined as a const, meaning a constant value, you cannot change what that assignment is only available after declaration What to use when? const by default use as the “go-to” variable declaration makes life easier for yourself and others when looking at your code, as it cannot be changed throughout the program and it will only have one value. lower chance for bugs let in loops still very useful use inside of a block scope when it is desirable to create a new variable every time the loop happens. var partially obselete, as let and const basically cover all of its use cases, and let and const remove some of the issues with using a var type variable declaration from Declaring variable: 9 of 51 (YouTube)]]></summary></entry><entry><title type="html">Comments [7 of 51]</title><link href="/2020/11/24/beginner-js-7.html" rel="alternate" type="text/html" title="Comments [7 of 51]" /><published>2020-11-24T08:00:00+00:00</published><updated>2020-11-24T08:00:00+00:00</updated><id>/2020/11/24/beginner-js-7</id><content type="html" xml:base="/2020/11/24/beginner-js-7.html"><![CDATA[<p>What are code comments?</p>
<ul>
  <li>
    <p>Comments are lines in your code that you can see, but that do not get executed</p>
  </li>
  <li>Single line comments
    <ul>
      <li>Add two // to the beginning of a line</li>
      <li>Most editors will change the color of the line to grey</li>
      <li>only applies to the current line - Any subsequent lines will not be commeneted out.</li>
      <li>For example:
        <div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  <span class="c1">// console.log(I am commented out");</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">"</span><span class="s2">But I'm not!</span><span class="dl">"</span><span class="p">)</span>
</code></pre></div>        </div>
      </li>
    </ul>
  </li>
  <li>Multi-line comments
    <ul>
      <li>Designed to comment out multiple lines
        <ul>
          <li>Does not require comment slashes on every line add a “/*” to the start of the comment and a */ to the end of it</li>
          <li>Any text within those characters will be commented out</li>
        </ul>
      </li>
      <li>for example:
        <div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  <span class="cm">/*
  console.log("I am commented out.")
  console.log("Me to!)
  */</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">"</span><span class="s2">Not I</span><span class="dl">"</span><span class="p">)</span>
</code></pre></div>        </div>
      </li>
    </ul>
  </li>
  <li>Comments in VS Code
    <ul>
      <li>Automatically comments out lines with a special keyboard shortcut.
        <ul>
          <li>Linux/Windows: ctrl+/</li>
          <li>macOS: cmd+/</li>
          <li>toggles comments off/on</li>
        </ul>
      </li>
    </ul>
  </li>
  <li>Words from the wise
    <ul>
      <li>“If your code needs a comment to explain what it does, it’s probably too complicated.” - Burke Holland, who once put comments on literally everything.</li>
      <li>Take it easy with comments: To keep your code clean, try to steer clear of comments and instead make your code easier to read.<br />
<em>from: <a href="https://youtu.be/Wm89TVXGflk?list=PLlrxD0HtieHhW0NCG7M536uHGOtJ95Ut2">Comments [7 of 51] | Beginner’s Series to JavaScript (YouTube)</a></em></li>
    </ul>
  </li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[What are code comments? Comments are lines in your code that you can see, but that do not get executed]]></summary></entry><entry><title type="html">Demo: Comments [8 of 51]</title><link href="/2020/11/24/beginner-js-8.html" rel="alternate" type="text/html" title="Demo: Comments [8 of 51]" /><published>2020-11-24T08:00:00+00:00</published><updated>2020-11-24T08:00:00+00:00</updated><id>/2020/11/24/beginner-js-8</id><content type="html" xml:base="/2020/11/24/beginner-js-8.html"><![CDATA[<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// console.log("Hello, infinity and beyond!")</span>

<span class="c1">// -------------------------</span>
<span class="c1">//  this code reverses a string</span>

<span class="cm">/*
Multi-line comments!!
*/</span>
</code></pre></div></div>
<p><em>from: <a href="https://youtu.be/h3HyK2k3cZ4?list=PLlrxD0HtieHhW0NCG7M536uHGOtJ95Ut2">Demo: Comments [8 of 51] | Beginner’s Series to JavaScript (YouTube)</a></em></p>]]></content><author><name></name></author><summary type="html"><![CDATA[```javascript // console.log(“Hello, infinity and beyond!”)]]></summary></entry><entry><title type="html">Creating your first application [6 of 51]</title><link href="/2020/11/23/beginner-js-6.html" rel="alternate" type="text/html" title="Creating your first application [6 of 51]" /><published>2020-11-23T08:00:00+00:00</published><updated>2020-11-23T08:00:00+00:00</updated><id>/2020/11/23/beginner-js-6</id><content type="html" xml:base="/2020/11/23/beginner-js-6.html"><![CDATA[<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#!/usr/bin/env node
</span><span class="c1">// From: &lt;https://www.youtube.com/watch?v=nQu2bbh4Vyc&gt;</span>
<span class="c1">// Example #1</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Example 1:</span><span class="dl">'</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Hello World🌎</span><span class="dl">'</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1"> </span><span class="dl">'</span><span class="p">);</span>

<span class="c1">// Example #2</span>
<span class="c1">// Set some variables</span>
<span class="kd">const</span> <span class="nx">place</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">World</span><span class="dl">"</span><span class="p">;</span>
<span class="kd">const</span> <span class="nx">greeting</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">Hello</span><span class="dl">"</span><span class="p">;</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Example 2:</span><span class="dl">'</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">%s, %s,</span><span class="dl">'</span><span class="p">,</span> <span class="nx">greeting</span><span class="p">,</span> <span class="nx">place</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1"> </span><span class="dl">'</span><span class="p">);</span>

<span class="c1">// Example #3 (Template literals - backticks)</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Example 3:</span><span class="dl">'</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`</span><span class="p">${</span><span class="nx">greeting</span><span class="p">}</span><span class="s2">, </span><span class="p">${</span><span class="nx">place</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
</code></pre></div></div>

<p><em>from: <a href="https://youtu.be/nQu2bbh4Vyc">Creating your first application [6 of 51 ] (YouTube) </a></em></p>]]></content><author><name></name></author><summary type="html"><![CDATA[```javascript #!/usr/bin/env node // From: https://www.youtube.com/watch?v=nQu2bbh4Vyc // Example #1 console.log(‘Example 1:’); console.log(‘Hello World🌎’); console.log(‘ ‘);]]></summary></entry><entry><title type="html">Building your toolbox [4 of 51]</title><link href="/2020/11/22/beginner-js-4.html" rel="alternate" type="text/html" title="Building your toolbox [4 of 51]" /><published>2020-11-22T08:00:00+00:00</published><updated>2020-11-22T08:00:00+00:00</updated><id>/2020/11/22/beginner-js-4</id><content type="html" xml:base="/2020/11/22/beginner-js-4.html"><![CDATA[<p>Visual Studio Code</p>
<ul>
  <li>Write, debug, and document your code</li>
  <li>source control management</li>
  <li>built-in terminal</li>
  <li>Customizable and extensible</li>
  <li>Free, cross-platform, and open-source</li>
</ul>

<p>VS Code Extensions for JavaScript Developers</p>
<ul>
  <li>ESLint
    <ul>
      <li>Find and fix problems in your JavaScript code before it hits production</li>
    </ul>
  </li>
  <li>Prettier:
    <ul>
      <li>Automatic code formatter, so you don’t have to care about that extra space</li>
    </ul>
  </li>
  <li>JavaScript (ES6) code snippets
    <ul>
      <li>Avoid redundant typing with shortcuts to most used code fragments</li>
    </ul>
  </li>
</ul>

<p>Node.js</p>
<ul>
  <li>What is Node.js?
    <ul>
      <li>Node.js is a JavaScript runtime used to execute JavaScript code outside of a web browser<br />
<em>from <a href="https://youtu.be/69WJeXGBdxg?list=PLlrxD0HtieHhW0NCG7M536uHGOtJ95Ut2">Building your toolbox [4 of 51] | Beginner’s Series to JavaScript (YouTube)</a></em></li>
    </ul>
  </li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[Visual Studio Code Write, debug, and document your code source control management built-in terminal Customizable and extensible Free, cross-platform, and open-source]]></summary></entry><entry><title type="html">Running JavaScript: browser or server: [3 of 51]</title><link href="/2020/11/21/beginner-js-3.html" rel="alternate" type="text/html" title="Running JavaScript: browser or server: [3 of 51]" /><published>2020-11-21T08:00:00+00:00</published><updated>2020-11-21T08:00:00+00:00</updated><id>/2020/11/21/beginner-js-3</id><content type="html" xml:base="/2020/11/21/beginner-js-3.html"><![CDATA[<p>JavaScript on the client vs JavaScript on the server</p>
<ul>
  <li>Client: Runs in a web browser using scripts and tags. Has access to web page functions and objects - Document Object Model (DOM)</li>
  <li>Server: Requires Node.js and has acccess to built-in and third-party packages. Usually for building things like web services</li>
  <li>Third bullet point: You should always have 3 bullet points 😎<br />
<em>from: <a href="https://www.youtube.com/watch?v=tGOxIKstXiA&amp;list=PLlrxD0HtieHhW0NCG7M536uHGOtJ95Ut2&amp;index=3">Running JavaScript: browser or server: 3 of 51 (YouTube)</a></em></li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[JavaScript on the client vs JavaScript on the server Client: Runs in a web browser using scripts and tags. Has access to web page functions and objects - Document Object Model (DOM) Server: Requires Node.js and has acccess to built-in and third-party packages. Usually for building things like web services Third bullet point: You should always have 3 bullet points 😎 from: Running JavaScript: browser or server: 3 of 51 (YouTube)]]></summary></entry></feed>