<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by James Hughes on Medium]]></title>
        <description><![CDATA[Stories by James Hughes on Medium]]></description>
        <link>https://medium.com/@james.a.hughes?source=rss-9b945a9ed246------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yE7GOBs0oYxFHA4ZbjAAQQ.jpeg</url>
            <title>Stories by James Hughes on Medium</title>
            <link>https://medium.com/@james.a.hughes?source=rss-9b945a9ed246------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 08:27:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@james.a.hughes/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[An ES6 Primer — Part 1: Variables]]></title>
            <link>https://medium.com/@james.a.hughes/an-es6-primer-part-1-variables-2fbf9e85de32?source=rss-9b945a9ed246------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fbf9e85de32</guid>
            <category><![CDATA[beginner-coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[beginner-javascript]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[James Hughes]]></dc:creator>
            <pubDate>Wed, 11 Jul 2018 17:02:52 GMT</pubDate>
            <atom:updated>2018-07-18T15:46:42.738Z</atom:updated>
            <content:encoded><![CDATA[<h3>Variable Declarations</h3><p>The first thing that is important to know about ES6 is the introduction of the <em>let</em> and <em>const</em> variable syntax. In ES6 you should no longer use <em>var </em>to declare a variable. Instead, you will use either use <em>let</em> or <em>const</em>. The difference between <em>let</em> and const is that <em>const</em> should be used for a <strong>constant</strong>, meaning the variable will <strong>not be re-defined</strong> in your code down the road. If you try to re-define a <em>const</em> variable, it will result in an error!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*XcE5RrZLmFymfYUcysXv9A.png" /></figure><p>If you are unsure whether to use <em>let</em> or <em>const</em>, a good general rule to follow is to always use <em>const</em> in your declarations, unless you know that you will be re-defining it — in which case, use <em>let</em>.</p><h3>Scope</h3><p>Another important aspect to note with ES6 variables is that scoping is different. Variables declared with the typical <em>var</em> in JS are function scoped, while variables declared with <em>const</em> and <em>let</em> are block scoped, as you can see in the example below (if you are unfamiliar or new to ‘scope’, there is a pretty good explanation <a href="https://www.sitepoint.com/demystifying-javascript-variable-scope-hoisting/">here</a> that you can check out).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1fumjd1IQdyO505_aV-ESw.png" /></figure><p>The ES5 example above works as you would expect it. But in the ES6 example, because <em>const place</em> and <em>let job</em> are block scoped (meaning, only accessible within the if block), calling the faveMovie function results in an error due to place and job not being defined.</p><p>We can fix this by moving the variable declarations outside of the <em>if</em> statement. Much like using <em>var</em> in ES5, a <em>let</em> can be declared without a definition, then given a definition down the road. A <em>const</em> requires a definition upon declaration however — so in my fix I changed place to a <em>let</em>, and declared the variables without a definition outside of the <em>if</em> block, and then defined them within the <em>if</em> block:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FEoZmaxFmQEgHvVxIFLWmw.png" /></figure><p>Because let place and let job are declared in the same block as the console.log that uses them (even though they are not defined there), they are accessible and the function works.</p><p><strong>Hoisting</strong> also works a little differently in ES6. The important thing to remember is that in ES6 (using <em>const </em>or <em>let</em>), a variable must be declared before it is used, otherwise it will result in an error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*UXymQ3InPTKHpZYqORzlZA.png" /></figure><p>If we would have used <em>var</em> instead of <em>let</em> (the ES5 way), it would have logged ‘undefined’, as the variable would have been <a href="https://www.w3schools.com/js/js_hoisting.asp">hoisted</a> and set to undefined.</p><p>Stay tuned for more from this ES6 PRIMER series — In part 2 we will discuss Arrow Functions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fbf9e85de32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTML: Setting a Value For an Unchecked Check-box]]></title>
            <link>https://medium.com/@james.a.hughes/html-setting-a-value-for-an-unchecked-check-box-5eef734b4a14?source=rss-9b945a9ed246------2</link>
            <guid isPermaLink="false">https://medium.com/p/5eef734b4a14</guid>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[James Hughes]]></dc:creator>
            <pubDate>Fri, 06 Oct 2017 21:00:12 GMT</pubDate>
            <atom:updated>2017-10-06T21:00:12.949Z</atom:updated>
            <content:encoded><![CDATA[<p>I am currently working on a ‘menu builder’ application, in which I can add menu items to either a lunch or dinner menu (or both). My ‘items’ model has two attributes, ‘lunch’ and ‘dinner’ which are boolean values. I built my view for adding a new item to include check-boxes to indicate if the menu would be included on the lunch or dinner menu, and I also set up my model to validate presence for ‘lunch’ and ‘dinner’.</p><p>The problem I was running in to is that if I added a new menu item, and selected only the ‘dinner’ check-box for example, my value for ‘lunch’ would be <em>nil</em> (<em>null</em>), but I wanted it to be set to false — essentially, assign a value to an unchecked check-box.</p><p>The workaround is to include a hidden form field right before the checkbox in your HTML. The hidden form field must have the same ‘name’ as your checkbox, and should also include your default value for an unchecked box.</p><p>Ex:</p><pre><strong>&lt;input </strong>type=”hidden” name=”lunch&quot; value=”false&quot;<strong> /&gt;<br>&lt;input </strong>type=”checkbox” name=”lunch&quot; value=”true&quot;<strong> /&gt;</strong></pre><p>The code above sets the value for ‘lunch’ to be ‘false’ if it is left unchecked, rather than nil.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5eef734b4a14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using ‘Case Statements’ in Ruby]]></title>
            <link>https://medium.com/@james.a.hughes/using-case-statements-in-ruby-cf64946f093?source=rss-9b945a9ed246------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf64946f093</guid>
            <dc:creator><![CDATA[James Hughes]]></dc:creator>
            <pubDate>Tue, 19 Sep 2017 20:36:58 GMT</pubDate>
            <atom:updated>2017-09-25T02:26:04.549Z</atom:updated>
            <content:encoded><![CDATA[<p>I have learned a lot from ‘<a href="http://www.codewars.com/">codewars</a>’, which is a site that essentially gives you coding challenges (called ‘katas’) and rewards you with points for those that you solve. It is a great site, as there is a large array (pun intended) of challenges at various difficulty levels. My favorite thing about the site is when you solve a challenge, you are given the solutions that other people came up with — and the ‘best practice’ suggestion. Looking at the best practice and other coders solutions has helped me learn a lot of new methods with Ruby.</p><p>One of my favorites is the ‘case statement’, which I strongly suggest you get familiar with if you are a beginning coder.</p><p>A case statement essentially replaces a bunch of <em>ifs</em>. Say for example, we want to write a method that tells you what color a billiard ball is based on it’s number. It is pretty to simple to do this using if/elsif as below:</p><pre>def what_color(num)<br>  if num == 1 or num == 9<br>    puts &quot;The #{num} ball is yellow&quot;<br>  elsif num == 2 or num == 10<br>    puts &quot;The #{num} ball is blue&quot;<br>  elsif num == 3 or num == 11<br>    puts &quot;The #{num} ball is red&quot;<br>  elsif num == 4 or num == 12<br>    puts &quot;The #{num} ball is purple&quot;<br>  elsif num == 5 or num == 13<br>    puts &quot;The #{num} ball is orange&quot;<br>  elsif num == 6 or num == 14<br>    puts &quot;The #{num} ball is green&quot;<br>  elsif num == 7 or num == 15<br>    puts &quot;The #{num} ball is maroon&quot;<br>  elsif num == 8<br>    puts &quot;The #{num} ball is black&quot;<br>  end<br>end</pre><p>We can accomplish the same thing using a case statement (this example is not refactored as much as it should be for the purpose of demonstration):</p><pre>def what_color(num)<br>  case num<br>  when 1<br>    puts &quot;The #{num} ball is yellow&quot;<br>  when 2<br>    puts &quot;The #{num} ball is blue&quot;<br>  when 3<br>    puts &quot;The #{num} ball is red&quot;<br>  when 4<br>    puts &quot;The #{num} ball is purple&quot;<br>  when 5<br>    puts &quot;The #{num} ball is orange&quot;<br>  when 6<br>    puts &quot;The #{num} ball is green&quot;<br>  when 7<br>    puts &quot;The #{num} ball is maroon&quot;<br>  when 8<br>    puts &quot;The #{num} ball is black&quot;<br>  when 9<br>    puts &quot;The #{num} ball is yellow&quot;<br>  when 10<br>    puts &quot;The #{num} ball is blue&quot;<br>  when 11<br>    puts &quot;The #{num} ball is red&quot;<br>  when 12<br>    puts &quot;The #{num} ball is purple&quot;<br>  when 13<br>    puts &quot;The #{num} ball is orange&quot;<br>  when 14<br>    puts &quot;The #{num} ball is green&quot;<br>  when 15<br>    puts &quot;The #{num} ball is maroon&quot;<br>  end<br>end</pre><p>Essentially, the way a case statement works is that you specify an expression (<em>num </em>in the example above) by <em>case</em>, and compare it multiple options (when clauses).</p><p>We can refactor the above code further by giving the when clauses multiple options, separated by a comma:</p><pre>def what_color(num)<br>  case num<br>  when 1, 9<br>    puts &quot;The #{num} ball is yellow&quot;<br>  when 2, 10<br>    puts &quot;The #{num} ball is blue&quot;<br>  when 3, 11<br>    puts &quot;The #{num} ball is red&quot;<br>  when 4, 12<br>    puts &quot;The #{num} ball is purple&quot;<br>  when 5, 13<br>    puts &quot;The #{num} ball is orange&quot;<br>  when 6, 14<br>    puts &quot;The #{num} ball is green&quot;<br>  when 7, 15<br>    puts &quot;The #{num} ball is maroon&quot;<br>  when 8<br>    puts &quot;The #{num} ball is black&quot;<br>  end<br>end</pre><p>If we wanted to get a variable containing the color of the ball, we can do so very simply by assigning the <em>case </em>to a variable and using<em> ‘then’:</em></p><pre>def what_color(num)<br>  color = case num<br>    when 1, 9 then &quot;yellow&quot;<br>    when 2, 10 then &quot;blue&quot;<br>    when 3, 11 then &quot;red&quot;<br>    when 4, 12 then &quot;purple&quot;<br>    when 5, 13 then &quot;orange&quot;<br>    when 6, 14 then &quot;green&quot;<br>    when 7, 15 then &quot;maroon&quot;<br>    when 8 then &quot;black&quot; <br>  end<br>  return color<br>end</pre><p>Using the example above:</p><pre>what_color(9) =&gt; &quot;yellow&quot;<br>what_color(4) =&gt; &quot;purple&quot;<br>what_color(8) =&gt; &quot;black&quot;<br>etc. </pre><p>Case Statements may not allow you to write significantly less code than ifs and elsifs, however I find them to be a lot less cumbersome — and appear much more eloquent.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf64946f093" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Refactoring if-else statements with the ternary operator (? :)]]></title>
            <link>https://medium.com/@james.a.hughes/refactoring-if-else-statements-with-the-ternary-operator-fa28439bdf35?source=rss-9b945a9ed246------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa28439bdf35</guid>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[James Hughes]]></dc:creator>
            <pubDate>Tue, 27 Jun 2017 21:21:23 GMT</pubDate>
            <atom:updated>2017-06-27T21:21:23.144Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are a new coder, I recommend getting familiar with the ‘ternary operator’ (often called the conditional operator) as quickly as possible, as its use is recommended when possible. The ternary operator can be used in just about any programming language, but for the purpose of showing it’s use I will be demonstrating on Ruby. Essentially, it is an alternate (and preferred) way of writing your simple if-else statements.</p><p>For this example, we are creating a method that will take a number (num) as an argument. If the number is even, it will return “even”. If it’s an odd number, it will return “odd”. This is the method written with an if-else statement:</p><pre><strong>def even_or_odd(num)<br>  if num % 2 == 0 <br>    return &quot;even&quot; <br>  else <br>    return &quot;odd&quot; <br>  end<br>end</strong></pre><pre>def even_or_odd(2) <br>=&gt; &quot;even&quot;</pre><pre>def even_or_odd(3)<br>=&gt; &quot;odd&quot;</pre><p>Before we get to the ternary operator, we’re going to refactor this just a bit more so it makes more sense once we use the ternary operator. Remember, you do not have to include ‘return’, as ruby will automatically return the last thing that occurs. So the above code can be written like this:</p><pre><strong>def even_or_odd(num)<br>  if num % 2 == 0 <br>    &quot;even&quot; <br>  else <br>    &quot;odd&quot; <br>  end<br>end</strong></pre><pre>def even_or_odd(2) <br>=&gt; &quot;even&quot;</pre><pre>def even_or_odd(3)<br>=&gt; &quot;odd&quot;</pre><p>Notice that ‘return’ is no longer there, but it works just the same. Knowing that we don’t need to type ‘return’ — lets now refactor the if-else statement into one line of code with the ternary operator!</p><pre><strong>def even_or_odd(num)<br>  num % 2 == 0 ? &quot;even&quot; : &quot;odd&quot;<br>end</strong></pre><p>Easy as that! It works exactly the same as the if-else statement. Confused? You can think of it this way:</p><pre><strong>(condition) ? (true_return_value) : (false_return_value)</strong></pre><p>We have a conditional statement (the statement that is either going to be true or false), followed by a question mark ‘?’. We then enter the return value if the conditional is true, which is followed by a colon ‘:’. Lastly, we enter our return value if the condition is false.</p><p>Get used to the ternary operator, and use it whenever possible!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa28439bdf35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using the ‘reduce’ method in Ruby]]></title>
            <link>https://medium.com/@james.a.hughes/using-the-reduce-method-in-ruby-907f3c18ae1f?source=rss-9b945a9ed246------2</link>
            <guid isPermaLink="false">https://medium.com/p/907f3c18ae1f</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[James Hughes]]></dc:creator>
            <pubDate>Sat, 10 Jun 2017 01:52:17 GMT</pubDate>
            <atom:updated>2020-12-09T22:51:25.909Z</atom:updated>
            <content:encoded><![CDATA[<p>The ‘reduce’ method can be used to take an array and reduce it to a single value. Lets start with a simple demonstration of this method.</p><p>Lets say we want write a method to find the sum of all numbers in an array of numbers. You may be inclined to write your code in this manner:</p><pre>def sum(array)<br>  sum = 0<br>  array.each do |number|<br>    sum += number<br>  end<br>  return sum <br>end </pre><pre>p sum([5, 10, 20])<br># =&gt; 35</pre><p>Using the reduce method however, we can reduce the code inside the sum method into a single line:</p><pre>def sum(array)<br>  array.reduce(0) { |sum, num| sum + num }<br>end</pre><pre>p sum([5, 10, 20])<br># =&gt; 35</pre><p>Looking at the above, the ‘0’ in ‘array.reduce(0) sets the initial value.</p><p>After that, we have two parameters in the method (|sum, num|). The first parameter, which we call ‘sum’ here is the total that will eventually be returned. The second parameter, which we call ‘num’ is the current number as we iterate through the array. After that, with ‘sum + num’ we are essentially telling the method that we we want to add the current number to the sum each time we iterate through. In the example above, the sum would increase from 0, to 5, to 15, and finally to 35.</p><p>We can refactor the code even more by using this shortcut:</p><pre>def sum(array)<br>  array.reduce(:+)<br>end</pre><pre>p sum([5, 10, 20])<br># =&gt; 35</pre><p>Note that ‘reduce’ method is often called ‘inject’.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=907f3c18ae1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using the ‘select’ Method in Ruby]]></title>
            <link>https://medium.com/@james.a.hughes/using-the-select-method-in-ruby-cf7a2cc21013?source=rss-9b945a9ed246------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf7a2cc21013</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[James Hughes]]></dc:creator>
            <pubDate>Tue, 25 Apr 2017 18:08:03 GMT</pubDate>
            <atom:updated>2017-04-25T18:08:03.371Z</atom:updated>
            <content:encoded><![CDATA[<p>The ‘select’ method is used to only <em>select </em>the elements in an array that meet a certain criteria. For example, if we had an array of numbers and wanted to grab the even numbers, we may normally write the code like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*X3EEtu-mniIZjad5SZJYfg.png" /><figcaption>Return even numbers without using ‘select’</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/179/1*lB6XlpYNXBYjUoQCVKcEDA.png" /><figcaption>What gets returned</figcaption></figure><p>We can simplify our code by using the ‘select’ method as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*7EKIr72ZzASAKR0MX-WXzA.png" /><figcaption>Return even numbers using ‘select’</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/179/1*lB6XlpYNXBYjUoQCVKcEDA.png" /><figcaption>What gets returned</figcaption></figure><p>—</p><p>Another useful implementation of <em>select </em>is to use it on an array of hashes to filter down to hashes that meet your desired criteria. Say for example, we have an array of hashes, with each hash containing information related to an employee:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*dnNoojS93n_MnKzpGELQwg.png" /><figcaption>‘map’ method used on an array of hashes</figcaption></figure><p>In the example above, we use the following code to iterate through the array of employees, and select only the employees whose department is equal to ‘Sales’:</p><p>employee.select { |employee| employee[:department&quot; == &quot;Sales&quot; }</p><p>In return, we get an an array of employees in the sales department:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*r7g2CiXAcYCslgYutgrLNw.png" /><figcaption>What gets returned</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf7a2cc21013" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using the ‘map’ Method in Ruby]]></title>
            <link>https://medium.com/@james.a.hughes/using-the-map-method-in-ruby-1b60ec030383?source=rss-9b945a9ed246------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b60ec030383</guid>
            <dc:creator><![CDATA[James Hughes]]></dc:creator>
            <pubDate>Fri, 17 Mar 2017 18:38:33 GMT</pubDate>
            <atom:updated>2017-10-11T01:27:13.921Z</atom:updated>
            <content:encoded><![CDATA[<p>The ‘map’ method can be used to modify each element in an existing array in the same manner. It is important to note that a new array will be returned with the modified elements when the map method is used, however the original array does not change.</p><p>For example, if you want to take an array of numbers and multiply each number by 5, you can use the map method like this:</p><pre>[4, 2, 6, 3, 5]<strong>.map</strong> { |num| num * 5 }</pre><p>The following array will be returned:</p><pre>=&gt; [20, 10, 30, 15, 25]</pre><p>—</p><p>As mentioned earlier, map does not change the existing array, it simply returns a modified version of it. To demonstrate this lets run the same code as above, but with the array saved as a variable:</p><pre>numbers_array = [4, 2, 6, 3, 5]<br>numbers_array.map { |num| num * 5 }</pre><p>This will still return:</p><pre>=&gt; [20, 10, 30, 15, 25]</pre><p>numbers_array remains unchanged, however:</p><pre>numbers_array = [4, 2, 6, 3, 5]<br>numbers_array.map { |num| num * 5 }</pre><pre>p numbers_array</pre><p>This will still p (show) numbers_array as:</p><pre>[4, 2, 6, 3, 5]</pre><p>—</p><p>An additional use of the map method is that it can be used to easily take an array of hashes, and put all of the values for a certain key into an array. Lets say we have an array of hashes, with each hash containing information about a human:</p><pre>humans = [<br>  {<br>    &quot;first_name&quot; =&gt; &quot;Jane&quot;,<br>    &quot;last_name&quot; =&gt; &quot;Doe&quot;,<br>    &quot;favorite_book&quot; =&gt; &quot;To Kill a Mockingbird&quot; <br>   },<br>   {<br>    &quot;first_name&quot; =&gt; &quot;John&quot;,<br>    &quot;last_name&quot; =&gt; &quot;Doe&quot;,<br>    &quot;favorite_book&quot; =&gt; &quot;Pride and Prejudice&quot;<br>   },<br>   {<br>    &quot;first_name&quot; =&gt; &quot;James&quot;,<br>    &quot;last_name&quot; =&gt; &quot;Hughes&quot;,<br>    &quot;favorite_book&quot; =&gt; &quot;Moby Dick&quot;<br>   }<br>]</pre><p>We want to pull the <em>favorite_book</em> of our employees into a single array. We can do so by using the map method as follows:</p><pre>books_array = humans.map { |hash| hash[&quot;favorite_book&quot;] }</pre><p>If we then run:</p><pre>p books_array</pre><p>we get:</p><pre>[&quot;To Kill a Mockingbird&quot;, &quot;Pride and Prejudice&quot;, &quot;Moby Dick&quot;]</pre><p>—</p><p>As noted earlier, when map is used on an array, it will not change the actual array. It simply <em>returns </em>a modified version of it. However, if you want to change the original array it is quite simple.</p><p>Lets set an array to a variable:</p><pre>test_array = [1, 2, 3, 4, 5]</pre><p>We want to change test_array so all of the numbers in it are doubled. We can do this with the following code:</p><pre><strong>test_array =</strong> test_array.map { |number| number * 2 }</pre><p>Now, because we’ve added ‘test_array =’ , we changed the array itself as evidenced below.</p><pre>p test_array</pre><pre>=&gt; [2, 4, 6, 8, 10]</pre><p>That is easy enough, but we can use less code by using ‘map!’.</p><p>‘map!’ does the exact same thing as ‘map’, however it actually modifies the original array instead of simply returning a modified version of it. Please see the examples below, which do the same thing:</p><p><strong>Ex 1</strong></p><pre>names_array = [James, Leticia, Cesar, David]<br>names_array = names_array.map { |name| name.upcase }</pre><p><strong>Ex 2</strong></p><pre>names_array = [James, Leticia, Cesar, David]<br>names_array<strong>.map!</strong> { |name| name.upcase }</pre><p>For both examples above, the following will be the result:</p><pre>p names_array</pre><pre>=&gt; [&quot;JAMES&quot;, &quot;LETICIA&quot;, &quot;CESAR&quot;, &quot;DAVID&quot;]</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b60ec030383" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Hello, World!”]]></title>
            <link>https://medium.com/@james.a.hughes/hello-world-1e850bad74f6?source=rss-9b945a9ed246------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e850bad74f6</guid>
            <dc:creator><![CDATA[James Hughes]]></dc:creator>
            <pubDate>Sat, 04 Mar 2017 20:50:44 GMT</pubDate>
            <atom:updated>2017-03-04T20:50:44.343Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*KrfJPtBF9UJxUhaK3bsR-A.png" /></figure><p>I’ve found myself being reintroduced to these two words several times over the last few months. I have been learning computer programming and it is common that the first program you write when learning a programming language is one that outputs the string, “Hello, World!”. I thought it appropriate to use the same two words as the subject to my introduction.</p><p>First, I need to backtrack a bit. For most of my life, I prepared for a career in music. I was a high school Band Director for several years, but largely due to the current state of affairs in the field of education, I made the difficult decision to take my life in a different direction. Besides music, I’ve always had an interest in technology. While researching online Computer Science programs, I stumbled upon an add for a ‘Coding Bootcamp’.</p><p>A Coding Bootcamp sounded like the perfect opportunity, as it would allow me to jump-start a new career in the exact field that I’m interested in without spending several years working towards another degree. I’ll be honest, I was apprehensive about committing to a ‘for-profit’ educational program, however I did a ton of research and spoke to several people including engineers at my current company, and it started to seem more and more like the right decision for me. I am now in week 2 of a coding bootcamp at ‘Actualize’, and things could not be going better. I am motivated to master the craft, and I have truly enjoyed the work we’ve completed so far.</p><p>This blog will serve to document my journey through learning code, and through the bootcamp itself. Hopefully, future beginners will find the information helpful to their own journeys into the coding world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e850bad74f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>