<?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>Forem: Minna N.</title>
    <description>The latest articles on Forem by Minna N. (@minna_xd).</description>
    <link>https://forem.com/minna_xd</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%2F486874%2Fd53b80c0-5d80-40e2-8e66-64b2fa6579a6.png</url>
      <title>Forem: Minna N.</title>
      <link>https://forem.com/minna_xd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/minna_xd"/>
    <language>en</language>
    <item>
      <title>Finally, Minna codes as a profession</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Tue, 08 Mar 2022 19:59:51 +0000</pubDate>
      <link>https://forem.com/minna_xd/finally-minna-codes-as-a-profession-38ob</link>
      <guid>https://forem.com/minna_xd/finally-minna-codes-as-a-profession-38ob</guid>
      <description>&lt;p&gt;Junior Software Developer.&lt;/p&gt;

&lt;p&gt;That's what my title at work is nowadays. I still have a bit of a hard time calling myself that because I don't really create original code. Also, we mostly work with a no-code tool so I suppose I'm only dipping my toes in coding. But, I'm ok with that. The language I work with is C++ which I didn't know beforehand. I got to know the syntax and keywords from a few online courses but that only helps so far.&lt;/p&gt;

&lt;p&gt;Delving into a massive, complex, age-old codebase is daunting. I've struggled with not knowing all the features there are. I've struggled with not knowing how to go about searching for the features I think I need (I've even thought about glancing through everything – uh, not gonna happen).&lt;/p&gt;

&lt;p&gt;Nevertheless, I code. For work.&lt;/p&gt;

&lt;p&gt;And I'm learning! I take sneak peeks at what our senior developer is doing, how they're solving problems, I follow all possible work that's going on, I look at the logged bugs and try to find out their fixes. I'm proud of my ability to recognize the code bits I need and adapt them to my needs.&lt;/p&gt;

&lt;p&gt;I started by saying I don't feel like a software developer. What I prefer calling myself is a game porting engineer. And I'm super excited about that! I actually get to work with games and play them!&lt;/p&gt;

&lt;p&gt;What we do is make games run on our cloud gaming platform. There are some quality and user experience requirements to achieve, and the no-code tool is used to intercept different APIs and alter the way they work. And then, whatever is not preconfigured in the tool can be handled with a plugin written in C++.&lt;/p&gt;

&lt;p&gt;This is only the beginning. Perhaps this time next year I've shed the junior from my title!&lt;/p&gt;

&lt;p&gt;&lt;small&gt;Photo by &lt;a href="https://unsplash.com/@sortino?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Joshua Sortino&lt;/a&gt; on &lt;a href="https://unsplash.com/?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

</description>
      <category>wecoded</category>
    </item>
    <item>
      <title>Branching out this Hacktoberfest</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Sat, 09 Oct 2021 20:54:26 +0000</pubDate>
      <link>https://forem.com/minna_xd/branching-out-this-hacktoberfest-3jh3</link>
      <guid>https://forem.com/minna_xd/branching-out-this-hacktoberfest-3jh3</guid>
      <description>&lt;p&gt;Last year was my first time joining Hacktoberfest. I hadn't done much "serious" coding or developing (can't say that I still have) so I was sticking to what I felt comfortable with: translations.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/minna_xd" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F486874%2Fd53b80c0-5d80-40e2-8e66-64b2fa6579a6.png" alt="minna_xd"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/minna_xd/first-time-hacktoberfesting-bb" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;First time hacktoberfesting&lt;/h2&gt;
      &lt;h3&gt;Minna N. ・ Oct 25 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#hacktoberfest&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;This year, I started with the same idea because I enjoy doing translations but was struggling to find repos for that.&lt;/p&gt;

&lt;h2&gt;
  
  
  First sticking to what I know
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Abrynos" rel="noopener noreferrer"&gt;
        Abrynos
      &lt;/a&gt; / &lt;a href="https://github.com/Abrynos/ShoppingList" rel="noopener noreferrer"&gt;
        ShoppingList
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A simple shopping list application
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
 Somehow I found this repo which mentioned accepting translations. This ShoppingList is an Android app so I was also interested in looking at the code. I provided a Finnish translation which was quickly merged and built so I was able to check out the translated app right away. Very nice!&lt;br&gt;
(Managed to mess things up by creating a PR against the wrong branch but "in return" helped the maintainer to verify a fix to the CI pipeline. Need to re-learn git every time.)


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/appwrite" rel="noopener noreferrer"&gt;
        appwrite
      &lt;/a&gt; / &lt;a href="https://github.com/appwrite/appwrite" rel="noopener noreferrer"&gt;
        appwrite
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      The open-source Vercel alternative
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
 Appwrite was specifically looking for Finnish translations, so I contributed to that.  (Another brainfart made me, again, create a PR against a wrong branch.)
&lt;h2&gt;
  
  
  Next stepping out of the comfort zone, i.e. branching out
&lt;/h2&gt;

&lt;p&gt;Git pun intended! After the translations, I browsed through all kinds of "good for beginners" lists and labels and finally found a Hacktoberfest-labelled issue for Ghost, a CMS. They are refactoring their code to replace an i18n function and had very clear instructions so I thought, I can do this! I chose the file with the largest amount of changes needed and set to work. &lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/TryGhost" rel="noopener noreferrer"&gt;
        TryGhost
      &lt;/a&gt; / &lt;a href="https://github.com/TryGhost/Ghost" rel="noopener noreferrer"&gt;
        Ghost
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Independent technology for modern publishing, memberships, subscriptions and newsletters.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
 This was relaxing and I think I'll take some more files to edit.
&lt;h2&gt;
  
  
  Finally, a new contribution to Legesher
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/legesher" rel="noopener noreferrer"&gt;
        legesher
      &lt;/a&gt; / &lt;a href="https://github.com/legesher/legesher-translations" rel="noopener noreferrer"&gt;
        legesher-translations
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Home of all the translations for spoken languages into programming language
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
 Last year I helped review translated Python keywords for the Legesher project.  This year I wanted to help with a new language but it seemed like Python was still active for Finnish and no new programming languages had been added. I reached out to the maintainer and asked if it's ok to start a new language review process. She replied very fast and welcomed any contribution (also, remembered me from last year! 😊). So, I added translations for Java keywords. Hopefully I can gather a group to review these and the Python keywords from last Hacktoberfest.

&lt;p&gt;🔗 Related post: &lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/minna_xd" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F486874%2Fd53b80c0-5d80-40e2-8e66-64b2fa6579a6.png" alt="minna_xd"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/minna_xd/coding-in-your-native-language-have-you-heard-of-legesher-2jem" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Coding in your native language – have you heard of Legesher?&lt;/h2&gt;
      &lt;h3&gt;Minna N. ・ Nov 29 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#legesher&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#programming&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#learning&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#language&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Take 7, subtract 3 invalid ones, totals 4, phew! 😅
&lt;/h3&gt;

&lt;p&gt;My Hacktoberfest status is currently showing 7 PRs but two of those are duplicates from my branch-related bloopers, as mentioned. One PR is to a non-participating repo which I realized too late but the task was to review Finnish translations so I don't mind at all.&lt;/p&gt;

&lt;p&gt;If all goes well, I'll have at least 4 proper PRs under my belt for this year so I don't feel like a cheater when I hopefully get to order the t-shirt (only 50,000 sent out this year, uh oh).&lt;/p&gt;

&lt;h3&gt;
  
  
  Good momentum
&lt;/h3&gt;

&lt;p&gt;The non-participating repo I contributed to is &lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/javascript-tutorial" rel="noopener noreferrer"&gt;
        javascript-tutorial
      &lt;/a&gt; / &lt;a href="https://github.com/javascript-tutorial/fi.javascript.info" rel="noopener noreferrer"&gt;
        fi.javascript.info
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Modern JavaScript Tutorial in Finnish
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
 where JavaScript articles are being translated into Finnish. I took a look at possibly translating something but felt that it's a bit out of my league since I'm not very familiar with JavaScript lingo. However, I was thinking I could keep reviewing the articles because that way I'll also learn something by going through the tutorial! Win-win!

&lt;p&gt;As I mentioned, I think I'll also help with the Ghost refactoring some more if there is still work to be done. &lt;/p&gt;

&lt;p&gt;I can't promise I'll be brave enough to do any actual coding even next year but I'll be brave enough to widen my search of good issues to tackle.&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
    </item>
    <item>
      <title>She wanted to code, therefore she did</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Mon, 08 Mar 2021 22:00:08 +0000</pubDate>
      <link>https://forem.com/minna_xd/she-wanted-to-code-therefore-she-did-29fi</link>
      <guid>https://forem.com/minna_xd/she-wanted-to-code-therefore-she-did-29fi</guid>
      <description>&lt;p&gt;I don't really work in tech (or do I?) but over the years I also haven't come across people who thought I shouldn't or couldn't. Based on the stories I've heard and read, I've been lucky.&lt;/p&gt;

&lt;p&gt;My life with computers began with Commodore 64 and Windows 3.11. Dad had a job where he had access to "the latest tech" so we had a PC or a laptop at home from very early on. Dad was (and is, at 66) a gamer and that's what I became first, too. Winter Games, Impossible Mission, Who Dares Wins, Maniac Mansion, Minesweeper... 😄 I learned to run C64 games from floppies and cassettes.&lt;/p&gt;

&lt;p&gt;Back in junior high in the mid-90's, I chose IT as an optional subject (we had to choose three; I also took cooking and handicraft). I think there were 3-4 girls in a class of 20. I don't know if that raised any eyebrows but I wouldn't have given a hoot if it did.&lt;/p&gt;

&lt;p&gt;Around that time I heard about HTML and started learning it mostly by myself. I got into making web pages and then styling them with CSS. And then came scripting in PHP and JavaScript. Web technologies has remained a dear hobby of mine and I'm currently updating my knowledge in it after a bit of a break due to, I don't know, other aspects of life.&lt;/p&gt;

&lt;p&gt;In university I did pick a humanities major but with a tech twist: computer linguistics. We were quite a balanced group of women and men. Computer studies were a mandatory minor for us. There I could also see a lot of women (could be that university in general is more popular with women), but perhaps we were in minority now that I think about it. Don't remember seeing many women in the Java study groups.&lt;/p&gt;

&lt;p&gt;In the middle of university I got hired by a translation company into a technical role (sort of a tech support). Others in the team were men at that time but there had been at least one woman before me and several came after me. I never experienced any bad attitude from others in the team and I was a popular helper in the company.&lt;/p&gt;

&lt;p&gt;After 15 years in the translation company, I was invited to an interview (and got hired) at a company that I suppose I should call a tech company: we work with cloud gaming. I don't yet work with the most technical part of it all, I mainly coordinate the game part. But the culture in the company is such that people are given good opportunities to study and grow into their dream role so who knows what I get to do in the future!&lt;/p&gt;

&lt;p&gt;I haven't had to struggle. I hope there will come a day when this is the norm: a girl/woman interested in tech or working in the field and people will think nothing of it.&lt;/p&gt;

</description>
      <category>wecoded</category>
    </item>
    <item>
      <title>What more I've learned from the Advent of Code (days 6-8)</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Sun, 13 Dec 2020 10:55:16 +0000</pubDate>
      <link>https://forem.com/levelupkoodarit/what-more-i-ve-learned-from-the-advent-of-code-days-6-8-3ji2</link>
      <guid>https://forem.com/levelupkoodarit/what-more-i-ve-learned-from-the-advent-of-code-days-6-8-3ji2</guid>
      <description>&lt;p&gt;After a pretty good start, I got stuck on day 7 for a long time and haven't wanted to spend &lt;em&gt;all&lt;/em&gt; my precious little free time with AoC. My day 7 recursion was looking pretty good but produced some false positives which I eventually weeded out manually and subtracted from the total. Part 2 is in shambles and I don't have a clear picture of how it should be solved. I heard people are figuring out the puzzles with pen&amp;amp;paper and I might try that, too. &lt;/p&gt;

&lt;p&gt;But! I've managed to solve days 6 and 8 with two stars. 😅 Current total: 15🌟&lt;/p&gt;

&lt;h1&gt;
  
  
  Nifty datatype: Sets
&lt;/h1&gt;

&lt;p&gt;One way to remove duplicate values from an array is to create a set out of it. Values in sets can only occur once. I used this feature on day 6 part 1: I collected all 'yes' answers from a group in an array first and then created the set:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let groupAsSet = [...new Set(groupArray)];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It was then easy to find the number of unique 'yes' answers from the group by &lt;code&gt;set.length&lt;/code&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Destructuring vol.2
&lt;/h1&gt;

&lt;p&gt;I enjoyed solving day 8 (at least part 1 😆). I started by separating the operation and argument.&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;let&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;operation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &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;For my original solution, this time I used a regular expression with &lt;code&gt;match&lt;/code&gt; method to also separate the sign and digits.&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;let&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sign&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;(\+&lt;/span&gt;&lt;span class="sr"&gt;|&lt;/span&gt;&lt;span class="se"&gt;\-)(\d&lt;/span&gt;&lt;span class="sr"&gt;+&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using the underscore is the influence of &lt;a class="mentioned-user" href="https://dev.to/caiangums"&gt;@caiangums&lt;/a&gt;. 😊 I saw this usage in his code: the first element in the array that &lt;code&gt;match&lt;/code&gt; returns is the whole matched string for the regex between &lt;code&gt;/.../&lt;/code&gt;, which I have no use for, and using an underscore nicely depicts that.&lt;/p&gt;

&lt;p&gt;Next I used the sign and number to calculate changes in either accumulator or program position (index). I wanted to use the ternary operator here.&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;sign&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;+&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;accumulator&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;accumulator&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;(...)&lt;/span&gt;
&lt;span class="nx"&gt;sign&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;+&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But... I ended up cleaning up my code and just converted the argument to number directly:&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;argument&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;(...)&lt;/span&gt;
&lt;span class="nx"&gt;accumulator&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Much cleaner! Can't believe I didn't think of it right away. 🤦&lt;/p&gt;

&lt;h1&gt;
  
  
  Reminder: Arrays are reference types
&lt;/h1&gt;

&lt;p&gt;On day 8, my solution was to &lt;code&gt;for&lt;/code&gt; loop through the boot code changing one command at a time. First I didn't realize I never "reset" the array at the beginning so I ended up just changing it one line at a time. Then I understood I needed a temporary array to make the one change:&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;let&lt;/span&gt; &lt;span class="nx"&gt;modifiedCommandArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;commandArray&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same thing happened again! Then it hit me: oh, right, arrays are reference types so I'm actually modifying the same array but just using a different name. Fixed the code by using the spread operator &lt;code&gt;...&lt;/code&gt;.&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;let&lt;/span&gt; &lt;span class="nx"&gt;modifiedCommandArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;commandArray&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Reminder: Include &lt;code&gt;break&lt;/code&gt; in your &lt;code&gt;switch&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;I didn't make this mistake – this time – but I'm quite sure I could and then wonder what's going on. For &lt;code&gt;switch&lt;/code&gt;-&lt;code&gt;case&lt;/code&gt; structure, you usually want to end your &lt;code&gt;case&lt;/code&gt; block with &lt;code&gt;break&lt;/code&gt; or all the remaining code will be executed as well. Whoops!&lt;/p&gt;

&lt;p&gt;I'm diggin' what my day 8 &lt;code&gt;switch&lt;/code&gt; structure looks like:&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="k"&gt;switch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;operation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;acc&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nx"&gt;accumulator&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;jmp&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nop&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;break&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 all this time! Plodding on. 👢👢&lt;/p&gt;

&lt;p&gt;&lt;small&gt;Cover photo by &lt;a href="https://unsplash.com/@oo7ab?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Okwaeze Otusi&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/bags?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

</description>
      <category>adventofcode</category>
      <category>javascript</category>
    </item>
    <item>
      <title>What I've learned from the Advent of Code so far (days 1-5)</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Sun, 06 Dec 2020 12:22:20 +0000</pubDate>
      <link>https://forem.com/levelupkoodarit/what-i-ve-learned-from-the-advent-of-code-so-far-days-1-5-1dm5</link>
      <guid>https://forem.com/levelupkoodarit/what-i-ve-learned-from-the-advent-of-code-so-far-days-1-5-1dm5</guid>
      <description>&lt;p&gt;I consider myself an advanced beginner in programming. I lack a lot of knowledge in best practices, gotchas, elegance... let alone algorithms, optimizations... I have no clue.&lt;/p&gt;

&lt;p&gt;I'm quite sure I won't make it through &lt;a href="https://adventofcode.com/" rel="noopener noreferrer"&gt;Advent of Code&lt;/a&gt; but I wanted to give it a go anyway. I first thought to use Java to solve the puzzles because I'm more comfortable processing line-by-line input and doing "tricks" with it (I did a comprehensive course on it just at the beginning of this year), but decided on JavaScript because it's more beneficial for the things I'm learning at the moment.&lt;/p&gt;

&lt;p&gt;On the first five days, I had a couple of facepalm moments 🤦 but also some proud moments 🏆.&lt;/p&gt;

&lt;p&gt;Here are some of the things that have helped me on puzzle-solving days 1-5.&lt;/p&gt;

&lt;h1&gt;
  
  
  Neat feature: Destructuring
&lt;/h1&gt;

&lt;p&gt;On day 2 I was quite proud of myself for remembering &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment" rel="noopener noreferrer"&gt;the destructuring assignment&lt;/a&gt; feature. The task is to process a list with the following data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int-int char: string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1-3 a: abcde
1-3 b: cdefg
2-9 c: ccccccccc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One line contains a password policy and a password, so first I separated the policy from the password&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;policy&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;: &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;Then I separated the numbers from the character in the policy:&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;character&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;policy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &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;And finally the first number and the second number (representing min and max values in the first part of the puzzle and two positions in the second part):&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;-&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;Very handy!&lt;/p&gt;

&lt;h1&gt;
  
  
  Neat method: Array.from()
&lt;/h1&gt;

&lt;p&gt;For the colour code validation on day 4, I use &lt;code&gt;indexOf()&lt;/code&gt;. First I had an array with the possible values like so:&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;let&lt;/span&gt; &lt;span class="nx"&gt;validChars&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;3&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;7&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;9&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;d&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;e&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;f&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;I got a tip to make it sooo much more elegant:&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;let&lt;/span&gt; &lt;span class="nx"&gt;validChars&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0123456789abcdef&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;Coolio! 😎 As it sounds like, here &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from" rel="noopener noreferrer"&gt;&lt;code&gt;Array.from()&lt;/code&gt;&lt;/a&gt; creates an array from the given string.&lt;/p&gt;

&lt;p&gt;If you are wondering why I'm processing the numbers as strings, it's just so much simpler because the valid characters are either numbers or strings. And actually, the value comes as a string to validation so &lt;code&gt;===&lt;/code&gt; works more reliably this way.&lt;/p&gt;

&lt;p&gt;I'm really digging this array of valid values, too. First I had&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;amb&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; 
    &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;blu&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; 
    &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;brn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; 
    &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gry&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; 
    &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;grn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; 
    &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hzl&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; 
    &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;oth&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;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;for the hair colour validation 😅 but I just changed it to&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;let&lt;/span&gt; &lt;span class="nx"&gt;validColors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;amb&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;blu&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;brn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gry&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;grn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hzl&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;oth&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;validColors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&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;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Tip: Break up processing into functions
&lt;/h1&gt;

&lt;p&gt;On day 4 you have to do data validation and I was puzzled by how I'd be able to end processing of an invalid value in a nested loop and get back to the outer loop to validate the next value. I got a tip – one that I should remember by now – that I should make more helper functions. There's no such thing as too many functions (within reason). 😄&lt;/p&gt;

&lt;p&gt;My colour code validation was made much simpler with a helper function that returns either true or false.&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;function&lt;/span&gt; &lt;span class="nf"&gt;hexValidity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hexValue&lt;/span&gt;&lt;span class="p"&gt;)&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;validChars&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0123456789abcdef&lt;/span&gt;&lt;span class="dl"&gt;'&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;colourArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hexValue&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="nx"&gt;colourArray&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;colourArray&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;for &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;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;colourArray&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&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;currentChar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;colourArray&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&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="nx"&gt;validChars&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;currentChar&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&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;return&lt;/span&gt; &lt;span class="kc"&gt;true&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;h1&gt;
  
  
  Tip: Create variables more often
&lt;/h1&gt;

&lt;p&gt;The code is easier to read when you first assign results of functions, values from arrays, etc. in variables and use them in another structure. For example in my colour validation code for day 4, I first had:&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;validChars&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;colourArray&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&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;Compare with&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;let&lt;/span&gt; &lt;span class="nx"&gt;currentChar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;colourArray&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&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="nx"&gt;validChars&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;currentChar&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&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;h1&gt;
  
  
  Tip: Use modulo where you can
&lt;/h1&gt;

&lt;p&gt;I keep forgetting how useful (and multi-use) modulo &lt;code&gt;%&lt;/code&gt; is. &lt;/p&gt;

&lt;p&gt;For my toboggan trajectory on day 3, I skip to the beginning of the line ("horizontal index" 0) when I go over the length of the array (31) so in my code, I subtract the length from the horizontal index if it's over 30 (last possible index). With modulo, I could just use &lt;code&gt;index % 31&lt;/code&gt; and be done with it.&lt;/p&gt;

&lt;p&gt;If you have a situation where a value has to loop back to 0 at some point, use modulo.&lt;/p&gt;

&lt;h1&gt;
  
  
  Best practice: Early exit
&lt;/h1&gt;

&lt;p&gt;It's best to start by validating your data so you can break out of a loop/function as early as possible. For example on day 4, it's wise to check if the passport ID even has the required 9 characters &lt;strong&gt;before&lt;/strong&gt; you start validating if each of the characters is a digit. Same with the hex colour codes: if it doesn't have a hash &lt;code&gt;#&lt;/code&gt; at the beginning and exactly 6 characters after it, there's no point validating it in more detail.&lt;/p&gt;

&lt;h1&gt;
  
  
  Take heed: Scope of variables
&lt;/h1&gt;

&lt;p&gt;This was a moment of a huge facepalm. On day 4 you have to do data validation, which in itself is quite complicated to do for seven different value types.&lt;/p&gt;

&lt;p&gt;After I'd extracted the value validation itself into a separate function, as mentioned above, I found myself facing an infinite loop. The code was able to process the first three values ok but then it got stuck looping with second and third value. A lot of debugging later, I was this much wiser: 💡 remember to &lt;strong&gt;always&lt;/strong&gt; declare the initial variable of a &lt;code&gt;for&lt;/code&gt; loop 💡 or the code may end up using a completely wrong variable.&lt;/p&gt;

&lt;p&gt;I had forgotten the &lt;code&gt;let&lt;/code&gt; from a couple of &lt;code&gt;for&lt;/code&gt; loops where used &lt;code&gt;i&lt;/code&gt; as the index counter. 🤦&lt;/p&gt;

&lt;p&gt;This actually brings to mind another tip for myself: keep in mind the existence of &lt;code&gt;for/of&lt;/code&gt; loop! I could've made my code a lot simpler with it.&lt;br&gt;
&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  A proud moment on day 3
&lt;/h1&gt;

&lt;p&gt;First I was completely at a loss with the puzzle on day 3: how am I supposed to figure out a trajectory through lines of data? I don't know about vectors or any map algorithms.&lt;/p&gt;

&lt;p&gt;I started visualizing the problem as a matrix, but then was unsure how that would be done in JavaScript (would've been easy-peasy in Java) but it got me a step further: I put the lines into an array (array item per line) for vertical movement and used &lt;code&gt;charAt&lt;/code&gt; for the horizontal dimension of my "matrix". Once I had my function for the part 1 working and I was looking at part 2, I first thought "oh no, the function is going to be so messy with the for loop times 5". But then I realized, if I refactor my first function a bit I can reuse it by giving the numbers for traversing (x steps right, y steps down) as parameters and just assign the results to variables. 🏆&lt;/p&gt;

&lt;p&gt;&lt;small&gt;Cover photo by &lt;a href="https://unsplash.com/@markusspiske?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Markus Spiske&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/advent-calendar?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

</description>
      <category>adventofcode</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Coding in your native language – have you heard of Legesher?</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Sun, 29 Nov 2020 20:13:01 +0000</pubDate>
      <link>https://forem.com/minna_xd/coding-in-your-native-language-have-you-heard-of-legesher-2jem</link>
      <guid>https://forem.com/minna_xd/coding-in-your-native-language-have-you-heard-of-legesher-2jem</guid>
      <description>&lt;p&gt;As developers, we are used to writing programming commands in English (this is just a pseudo example from my little Java game where I actually use Finnish in variable and function names – gasp – I may actually change it to English at some point):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;blocks&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="n"&gt;ready&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="nf"&gt;addBlock&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(!&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;ready&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;blocks&lt;/span&gt;&lt;span class="o"&gt;++;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For someone who doesn't speak English at all, learning all these keywords requires much more effort compared to someone who already understands English. An English speaker is able to deduct a lot of the code's meaning and, I would imagine, can more easily memorize the programming language.&lt;/p&gt;

&lt;p&gt;Take a look at the above example in a language you may not understand:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;yksityinen&lt;/span&gt; &lt;span class="n"&gt;kokonaisluku&lt;/span&gt; &lt;span class="n"&gt;palat&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;yksityinen&lt;/span&gt; &lt;span class="n"&gt;totuusarvo&lt;/span&gt; &lt;span class="n"&gt;valmis&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;julkinen&lt;/span&gt; &lt;span class="n"&gt;totuusarvo&lt;/span&gt; &lt;span class="n"&gt;lisääPala&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;jos&lt;/span&gt; &lt;span class="o"&gt;(!&lt;/span&gt;&lt;span class="n"&gt;tämä&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;valmis&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;tämä&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;palat&lt;/span&gt;&lt;span class="o"&gt;++;&lt;/span&gt;
    &lt;span class="n"&gt;palauta&lt;/span&gt; &lt;span class="n"&gt;tosi&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;palauta&lt;/span&gt; &lt;span class="n"&gt;epätosi&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;    
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How easily do you think you would learn that?&lt;br&gt;
As a Finn, how cool would it be to code like that!&lt;/p&gt;
&lt;h1&gt;
  
  
  Legesher project wants people to code in their native language
&lt;/h1&gt;

&lt;p&gt;Senja &lt;a class="mentioned-user" href="https://dev.to/sjarva"&gt;@sjarva&lt;/a&gt; introduced me to the delightful &lt;a href="https://docs.legesher.io/" rel="noopener noreferrer"&gt;Legesher&lt;/a&gt; project a while back. The project aims to take a step further from just &lt;a href="https://dev.to/sjarva/anyone-who-is-studying-the-basics-of-programming-should-have-the-right-to-study-them-in-their-own-native-language-1a28"&gt;learning the basics of programming in one's own language&lt;/a&gt;: imagine being able to &lt;em&gt;code&lt;/em&gt; in your own language!&lt;/p&gt;

&lt;p&gt;Senja invited me to help with reviewing the Finnish translations for Python keywords (Python is currently prioritized) and what an eye-opening experience it was! Some of them were very straightforward: &lt;code&gt;false&lt;/code&gt; - epätosi, &lt;code&gt;true&lt;/code&gt; - tosi, &lt;code&gt;class&lt;/code&gt; - luokka, &lt;code&gt;if&lt;/code&gt; - jos. Some of them were tricky: &lt;code&gt;elif&lt;/code&gt; isn't even English! Some of them were puzzling: for a language like Finnish which doesn't really have prepositions, &lt;code&gt;as&lt;/code&gt;, &lt;code&gt;for&lt;/code&gt;, &lt;code&gt;from&lt;/code&gt; and &lt;code&gt;in&lt;/code&gt; require quite creative translation.&lt;/p&gt;

&lt;p&gt;We'll see what the original translator and the other reviewers think but I was pretty proud of some of the suggestions I came up with. 😊&lt;/p&gt;
&lt;h1&gt;
  
  
  English dominates
&lt;/h1&gt;

&lt;p&gt;All the programming/markup/stylesheet languages I know are based on English: HTML, CSS, PHP, Java, JavaScript, Python... I've never had any problem with it (or found it strange) but now this got me thinking, are there &lt;em&gt;any&lt;/em&gt; programming languages that are not.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Non-English-based_programming_languages" rel="noopener noreferrer"&gt;Turns out there are&lt;/a&gt;! One of them is &lt;a href="https://github.com/fergusq/tampio" rel="noopener noreferrer"&gt;Tampio&lt;/a&gt; based on Finnish. 👍 What's your favourite?&lt;/p&gt;

&lt;p&gt;(Sure, there are entirely symbolic programming languages, but those based on natural languages are more interesting to me.)&lt;/p&gt;
&lt;h1&gt;
  
  
  You can help with Legesher, too
&lt;/h1&gt;

&lt;p&gt;If you know a language other than English well and want to help with the Legesher project, head on over to &lt;a href="https://github.com/legesher/legesher-translations" rel="noopener noreferrer"&gt;the GitHub repo&lt;/a&gt;. No matter whether you are translating or reviewing, you need to really think about which word best describes the meaning behind the programming keyword. You cannot just pick the first equivalent from a dictionary.&lt;/p&gt;

&lt;p&gt;I suppose that with Legesher I still cannot write Python 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;tulosta('Hei maailma!')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;because &lt;code&gt;print&lt;/code&gt; is a function name and I don't see them being translated in the project (do correct me if I'm wrong), but the project is a step in that direction – and perhaps function names etc. are in its future plans.&lt;/p&gt;

&lt;p&gt;Nevertheless, it was such a fun project to contribute to and I look forward to the reviewing and translation progressing!&lt;/p&gt;

&lt;p&gt;&lt;small&gt;Cover photo by &lt;a href="https://unsplash.com/@markusspiske?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Markus Spiske&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/matrix?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

</description>
      <category>legesher</category>
      <category>programming</category>
      <category>learning</category>
      <category>language</category>
    </item>
    <item>
      <title>Adding a high score table to #JavaScript30 Whack-a-mole</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Fri, 20 Nov 2020 20:10:55 +0000</pubDate>
      <link>https://forem.com/minna_xd/adding-a-high-score-table-to-javascript30-whack-a-mole-4adk</link>
      <guid>https://forem.com/minna_xd/adding-a-high-score-table-to-javascript30-whack-a-mole-4adk</guid>
      <description>&lt;h1&gt;
  
  
  #JavaScript30 – the 30-day vanilla JS coding challenge
&lt;/h1&gt;

&lt;p&gt;I heard about &lt;a href="https://javascript30.com/" rel="noopener noreferrer"&gt;Wes Bos's JavaScript30 challenge&lt;/a&gt; from &lt;a class="mentioned-user" href="https://dev.to/magdapoppins"&gt;@magdapoppins&lt;/a&gt;. I've been learning bits and pieces of JavaScript but nothing very extensive yet, and the short video tutorials appealed to me: it was something I'd be able to do almost any night (no matter how tired I was) after my kid had finally gone to sleep. I ended up completing the challenge in a bit over a month: from August 10 to September 15. 💪&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Untrue&lt;/em&gt; to my style, I wanted to keep some sort of a study diary (also inspired by Magda) so I could easily come back to it and remember the key points in each video. I used the readme.md of &lt;a href="https://github.com/minna-xD/JavaScript30" rel="noopener noreferrer"&gt;the repo&lt;/a&gt; for that.&lt;/p&gt;

&lt;p&gt;There were some interesting apps that I wish to develop further (speech detection and speech synthesis) and one that required using a phone (geolocation) so I ended up creating &lt;a href="https://minna-xd.github.io/JavaScript30/" rel="noopener noreferrer"&gt;a main page&lt;/a&gt; using GitHub Pages and link to the most interesting ones for easy access.&lt;/p&gt;

&lt;p&gt;A couple of the videos encouraged trying to solve a task first on your own and then checking the rest of the tutorial. Many of my solutions weren't that elegant so I don't dare display them, but I was quite proud – as still quite a rookie with all this – of the high score table that I created for &lt;a href="https://minna-xd.github.io/JavaScript30/30%20-%20Whack%20A%20Mole/index.html" rel="noopener noreferrer"&gt;the Whack-a-mole game&lt;/a&gt;. I'm sure there are things to improve but I'll go through my solution here and am happy to receive improvement suggestions. This time the extra task was just one of the suggested ways you could develop the game further, and there was no solution provided in the video.&lt;/p&gt;

&lt;h1&gt;
  
  
  Whack-a-mole
&lt;/h1&gt;

&lt;p&gt;Whack-a-mole is a game where you try to click as many gophers popping out of holes as you can.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tutorial sets up the page and the base game
&lt;/h2&gt;

&lt;p&gt;We have a group of holes and moles inside the game HTML.&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;"game"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"hole hole1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"mole"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&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;"hole hole2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"mole"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&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;"hole hole3"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"mole"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&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;"hole hole4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"mole"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&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;"hole hole5"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"mole"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&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;"hole hole6"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"mole"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&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;Then we begin the script by declaring constants for our main elements.&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;script&amp;gt;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;holes&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="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.hole&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;scoreBoard&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="nf"&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;.score&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;moles&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="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.mole&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;We set a couple of variables: We are keeping tabs of the latest hole a gopher popped up from because we don't want to get the same hole twice in a row. We also have a Boolean flag for ending the game, and we are keeping score.&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;let&lt;/span&gt; &lt;span class="nx"&gt;lastHole&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;timeUp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&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;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The moles are peeking from the holes at various speeds so we create random timers.&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;function&lt;/span&gt; &lt;span class="nf"&gt;randomTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;max&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;min&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;Naturally, the moles are peeking from random holes so we create a hole randomizer.&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;function&lt;/span&gt; &lt;span class="nf"&gt;randomHole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;holes&lt;/span&gt;&lt;span class="p"&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;index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;holes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&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;hole&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;holes&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;index&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;We don't want the same hole twice in a row so we check for it.&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="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="nx"&gt;hole&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;lastHole&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;randomHole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;holes&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;lastHole&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;hole&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;hole&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;The peeking (or peeping as this function is called) will last for a set time (set later in the &lt;code&gt;startGame&lt;/code&gt; function).&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;function&lt;/span&gt; &lt;span class="nf"&gt;peep&lt;/span&gt;&lt;span class="p"&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;time&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;randomTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&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;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hole&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;randomHole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;holes&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;The gopher going up and down is animated using CSS transitions so we add and remove a class here.&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="p"&gt;(...)&lt;/span&gt;
  &lt;span class="nx"&gt;hole&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="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;up&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;setTimeout&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="nx"&gt;hole&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="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;up&lt;/span&gt;&lt;span class="dl"&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;timeUp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;peep&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;time&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;The game is started, naturally, with a score of 0. Here the game lasts for 10000 milliseconds, or 10 seconds.&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;function&lt;/span&gt; &lt;span class="nf"&gt;startGame&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;scoreBoard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;timeUp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;peep&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;timeUp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10000&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 order for the click to be counted, it has to be done by a user and not a script so we check for cheaters. Once the click lands, the &lt;code&gt;up&lt;/code&gt; class is removed and the gopher starts returning to its hole. We also update the scoreboard.&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;function&lt;/span&gt; &lt;span class="nf"&gt;bonk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&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;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isTrusted&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// cheater!&lt;/span&gt;
  &lt;span class="nx"&gt;score&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;this&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="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;up&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;scoreBoard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;score&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;At the end of the script, we add event listeners for each mole.&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;moles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;mole&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;mole&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;bonk&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  I added a high score table
&lt;/h2&gt;

&lt;p&gt;At the end of the video, Wes gives some ideas of additional features for the game. One of them is a high score table that is saved in local storage. I wanted to try and create it.&lt;/p&gt;

&lt;p&gt;I'm saving the high scores in an array in local storage and I've added a table element for the scoreboard.&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;hiscores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hiscores&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&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;scoreList&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="nf"&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;.scoretable&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;My table shows the best 5 players and also has a clear button.&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;"hiscore"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Top 5 clickers&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;(on this device)&lt;span class="nt"&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;onClick=&lt;/span&gt;&lt;span class="s"&gt;"clearScores()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Clear&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;table&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"scoretable"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/table&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;I populate it from the local storage.&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;function&lt;/span&gt; &lt;span class="nf"&gt;populateTable&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;scoreList&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="nx"&gt;hiscores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;row&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="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clicker&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;score&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/tr&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&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 code snippet that keeps the game going until time is up, I added a &lt;code&gt;checkScore&lt;/code&gt; function which is run at the end of the game.&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="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;timeUp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;peep&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;checkScore&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;What the function does, is it eventually starts kicking out worst scores because I didn't want the list to be very long.&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;function&lt;/span&gt; &lt;span class="nf"&gt;checkScore&lt;/span&gt;&lt;span class="p"&gt;()&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;worstScore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&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="nx"&gt;hiscores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;worstScore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;hiscores&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;hiscores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;score&lt;/span&gt;&lt;span class="p"&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;If the score is better than the last one, the user is prompted to enter a name. The score and the name are added to the high score array.&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="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="nx"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;worstScore&lt;/span&gt;&lt;span class="p"&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;clicker&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prompt&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;score&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; – Top score! What's your name?`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;hiscores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;score&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;clicker&lt;/span&gt;&lt;span class="p"&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;Then the array is sorted from best to worst score.&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="p"&gt;(...)&lt;/span&gt;
  &lt;span class="nx"&gt;hiscores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;score&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&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;If the array is longer than 5 items, the last score is removed.&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="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="nx"&gt;hiscores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;hiscores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&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;Then the HTML table is refreshed and the scoreboard is also saved to local storage.&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="p"&gt;(...)&lt;/span&gt;
  &lt;span class="nf"&gt;populateTable&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hiscores&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hiscores&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;I wanted to add a button that empties the list (now that I think about it, I should've probably used &lt;code&gt;removeItem&lt;/code&gt; instead of setting an empty array, because it would remove my entry from the storage completely).&lt;/p&gt;

&lt;p&gt;At this point, I ran into an issue with emptying a &lt;code&gt;constant&lt;/code&gt; array. I solved it by using &lt;code&gt;splice&lt;/code&gt; to cut out items from the very first to the very last.&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;function&lt;/span&gt; &lt;span class="nf"&gt;clearScores&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;hiscores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;hiscores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hiscores&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hiscores&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="nf"&gt;populateTable&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;It was a lot of fun using stuff I'd learned during this challenge (such as local storage and populating an HTML table from an array in local storage) to create the additional feature. Playing the game was a lot of fun too. I think the best score I've got so far is 11. &lt;a href="https://minna-xd.github.io/JavaScript30/30%20-%20Whack%20A%20Mole/index.html" rel="noopener noreferrer"&gt;How good a clicker are you?&lt;/a&gt; 😊&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>javascript30</category>
      <category>game</category>
    </item>
    <item>
      <title>Questions equals dedication</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Wed, 11 Nov 2020 19:30:30 +0000</pubDate>
      <link>https://forem.com/minna_xd/questions-equals-dedication-4api</link>
      <guid>https://forem.com/minna_xd/questions-equals-dedication-4api</guid>
      <description>&lt;p&gt;If a translator asks you many clarifying questions about your code or application, they're not being annoying – &lt;strong&gt;they want to do their best job&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Say you have a furniture store and you have built a nice inventory management application. You are getting the application localised and a translator wants to know the meaning of 'table'. Are they an idiot? Surely not. It depends on the format of the localisation file, but context is super important in translation. In worst cases, the file contents may be alphabetised and therefore they've lost all context. In other cases, the string IDs may be something generic like &lt;code&gt;label1&lt;/code&gt;, &lt;code&gt;label2&lt;/code&gt; or &lt;code&gt;title&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;
  How would you translate 'table' into any other language you know? Or, if you're not a polyglot, you can think of this in terms of definitions: how would you &lt;em&gt;define&lt;/em&gt; 'table'? &lt;small&gt;(Click the paragraph/arrow)&lt;/small&gt;
  &lt;p&gt;How about now?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sofa&lt;/li&gt;
&lt;li&gt;table&lt;/li&gt;
&lt;li&gt;chair&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How about now?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pie chart&lt;/li&gt;
&lt;li&gt;table&lt;/li&gt;
&lt;li&gt;graph
&lt;/li&gt;
&lt;/ul&gt;




&lt;/p&gt;
&lt;p&gt;See? Even though the words in English are identical, they carry completely different meanings and will likely be translated using different words in another language. If this type of context information is not available through surrounding words, string IDs or comments, the translator is basically just &lt;strong&gt;flipping a coin&lt;/strong&gt;. More often than not, a multi-sided coin (if that were a thing). Sometimes they can make an educated guess but due to the concise nature of software texts, even that can easily go wrong. You, the developer, &lt;strong&gt;be unambiguous – or helpful and understanding – instead&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By the way, if for example those above two meanings of 'table' co-exist in an application, you'll need to handle that carefully in your &lt;strong&gt;translation memory&lt;/strong&gt;. Luckily, you can add multiple translations for one source text!&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/minna_xd" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F486874%2Fd53b80c0-5d80-40e2-8e66-64b2fa6579a6.png" alt="minna_xd"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/minna_xd/database-full-of-source-texts-and-their-translations-that-s-a-translation-memory-lfp" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Database full of source texts and their translations – that's a translation memory!&lt;/h2&gt;
      &lt;h3&gt;Minna N. ・ Nov 4 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#translation&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#localization&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tools&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;&lt;small&gt;Cover photo by &lt;a href="https://unsplash.com/@yakimadesign?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Jordan Rowland&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/coin-hand?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

</description>
      <category>translation</category>
      <category>localization</category>
      <category>ambiguity</category>
      <category>context</category>
    </item>
    <item>
      <title>Database full of source texts and their translations – that's a translation memory!</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Wed, 04 Nov 2020 21:04:50 +0000</pubDate>
      <link>https://forem.com/minna_xd/database-full-of-source-texts-and-their-translations-that-s-a-translation-memory-lfp</link>
      <guid>https://forem.com/minna_xd/database-full-of-source-texts-and-their-translations-that-s-a-translation-memory-lfp</guid>
      <description>&lt;p&gt;In my previous post, I told about my work as a localisation engineer and how the majority of my work is preparing different file formats to be translated in a translation tool with a translation memory attached.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/minna_xd" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F486874%2Fd53b80c0-5d80-40e2-8e66-64b2fa6579a6.png" alt="minna_xd"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/minna_xd/cats-are-the-technical-specialists-in-a-translation-company-4j9b" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;CATs 😸 are the technical specialists in a translation company&lt;/h2&gt;
      &lt;h3&gt;Minna N. ・ Nov 1 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#translation&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#localization&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;Using a translation tool and storing all your translations in a translation memory may help you be more efficient and consistent: Updates to a text are simple to process because you get all the unchanged parts straight from the memory without having to browse the finished translations from last time and compare which bits you can re-use. Translation memories also help you keep terminology consistent because you have an easily searchable database containing relevant material.&lt;/p&gt;

&lt;h1&gt;
  
  
  How it works
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Translation_memory" rel="noopener noreferrer"&gt;A translation memory&lt;/a&gt; (TM) stores all translations as units with source and target language – often with a lot of other information. The translation units usually consist of one segment: a sentence ending in a full stop, a question mark or an exclamation mark, or otherwise delimited unit of text, such as a heading, a spreadsheet name, a list item or a UI string.&lt;/p&gt;

&lt;p&gt;When translating, the translation tool searches the TM for exact or near matches (often called fuzzy matches) and presents them to the translator. The translator can then select the best one as is, edit as necessary, or write a new translation from scratch.&lt;/p&gt;

&lt;h1&gt;
  
  
  Things to consider
&lt;/h1&gt;

&lt;p&gt;Before you start using a translation memory, stop for a moment to think about how you should set it up and when you actually should use it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What information to store and where
&lt;/h2&gt;

&lt;p&gt;The basic bits of information that often get stored along with a source and target text are a timestamp (created/modified/used) and the creator/modifier of the translation unit.&lt;/p&gt;

&lt;p&gt;If you decide to set up a translation memory for yourself, you'll want to think if you want to store all your work in one database or several smaller ones (per customer/topic, for example). Assuming you won't be doing a lot of translating, I would perhaps use just one, main database but in that case I recommend using any labelling at your disposal in the specific tool. Usually, the tool adds selected labels automatically after you have entered the settings at the beginning of your work.&lt;/p&gt;

&lt;p&gt;The labels may be text fields that you can attach to each translation unit, so you should jot down the topic or context somehow:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Source: &lt;strong&gt;Tables&lt;/strong&gt;&lt;br&gt;
Target: &lt;strong&gt;Pöydät&lt;/strong&gt; 🇫🇮&lt;br&gt;
Customer: &lt;em&gt;Furniture Emporium&lt;/em&gt;&lt;br&gt;
Document: &lt;em&gt;Grand opening leaflet&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
&lt;p&gt;Source: &lt;strong&gt;Tables&lt;/strong&gt;&lt;br&gt;
Target: &lt;strong&gt;Taulukot&lt;/strong&gt; 🇫🇮&lt;br&gt;
Document: &lt;em&gt;Spreadsheet tutorial&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Labels can also help distinguish your work if you are translating for, say, two competing companies that have different terminologies. It would look bad if you used the wrong terminology!&lt;/p&gt;

&lt;p&gt;In a more professional setting, you'll most likely get access to an existing TM that you are expected to use. Even in that case, you can often attach your own TMs if you have collected some useful content in them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Text types
&lt;/h2&gt;

&lt;p&gt;Translation memories are not suited to all kinds of texts. When you are using one, the text is usually split into sentence-size segments. It is an additional step to merge these segments if you feel like changing the sentence structure a lot in your translation. Therefore, it is often said – and I believe it's true – that more creative or marketing texts shouldn't be translated in such a restrictive way.&lt;/p&gt;

&lt;p&gt;Translation memories work really well for technical, repetitive texts where it is important that the message is conveyed in a clear and consistent manner. Texts types like those are, for example, user manuals and other documentation or legal documents. For software translations, I would also use a translation memory but the text type is so concise that I would refrain from a lot of automatic processing. What I mean is that you shouldn't go ahead and insert previous translations "blindly" without making sure the selected translation is correct for the context. For example, buttons and dialogue titles may have different styles, sometimes even different parts of speech such as nouns for titles and verbs for buttons!&lt;/p&gt;

&lt;h1&gt;
  
  
  Translation tools
&lt;/h1&gt;

&lt;p&gt;In my work at a translation company, I mostly used SDL Trados Studio which is a popular tool but quite pricey for hobby use. Therefore, I'm sure I'll be looking into some free open source solutions just out of curiosity.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Have you tried out some translation tools? Any you would recommend?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  SDL Trados Studio &lt;a href="https://www.sdl.com/" rel="noopener noreferrer"&gt;🔗&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;SDL Trados Studio is like an IDE: it has everything integrated. You can attach translation memories, of course, and terminologies created in another SDL tool, Multiterm. You are able to process various file formats or even create your own "filters" (instructions for the tool on how to process a text file). But it's not cheap, so sometimes even freelancers are a bit hesitant to purchase it unless a proper workload is guaranteed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Matecat &lt;a href="https://www.matecat.com/" rel="noopener noreferrer"&gt;🔗&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;When I was starting my &lt;a href="https://dev.to/minna_xd/first-time-hacktoberfesting-bb"&gt;Hacktoberfest translat-a-thon&lt;/a&gt;, I wanted to utilize a translation tool. For my very first pull request, I started working on &lt;a href="https://github.com/TorstenDittmann/OmniaWrite" rel="noopener noreferrer"&gt;OmniaWrite&lt;/a&gt; which stores translations in a JSON file. I had searched what free tools people recommend and had found Matecat, which claims to support JSON. I signed up, set up the environment which looked nice and clear – but then it was unable to process this specific JSON format. I was too eager to get started with the translation that I didn't have any patience to investigate what was wrong.&lt;/p&gt;

&lt;p&gt;Since I have signed up for Matecat already, I'll be sure to try it out properly.&lt;/p&gt;

&lt;h2&gt;
  
  
  OmegaT &lt;a href="https://omegat.org/" rel="noopener noreferrer"&gt;🔗&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Another recommended tool that I looked into during Hacktoberfest was OmegaT. I remember playing with it in the past at work for some reason. The tool looks rugged but paired with &lt;a href="http://okapiframework.org" rel="noopener noreferrer"&gt;Okapi Framework&lt;/a&gt;'s ready-made filter plugins or other utilities, I believe it could be quite powerful to handle a lot of different file formats.&lt;/p&gt;

&lt;p&gt;However, in my impatient Hacktoberfest state, I didn't want to spend time learning the quirks and setting up the environment (software files usually require a bit of a setup compared to e.g. Word files).&lt;/p&gt;

&lt;h2&gt;
  
  
  Wordfast Anywhere &lt;a href="https://wordfast.com/products/wordfast_anywhere" rel="noopener noreferrer"&gt;🔗&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Wordfast is an old product family which has a free online version, Wordfast Anywhere. I haven't found the catch yet – except the fact that the list of supported file types is limited. However, if you're able to process your source file into XLIFF (XML Localization Interchange File Format) which is a standard file format for localization, you're able to translate it with this.&lt;/p&gt;

&lt;h1&gt;
  
  
  Term bases
&lt;/h1&gt;

&lt;p&gt;As a good sidekick to a translation memory, you can have &lt;a href="https://en.wikipedia.org/wiki/Termbase" rel="noopener noreferrer"&gt;a termbase&lt;/a&gt;. The simplest termbase contains just a term and its translations – actually, you don't even need translations if the termbase helps in authoring texts – but you can also have context and other information, and sometimes info on forbidden terms that writers shouldn't use. For example, referring to &lt;a href="https://sfconservancy.org/news/2020/jun/23/gitbranchname/" rel="noopener noreferrer"&gt;the fairly recent change in Git terminology&lt;/a&gt;, you could store information that 'master' is a deprecated term and 'main' is preferred. When connected to an editing tool (for translation or other), QA functionality could warn if the writer has used the incorrect term by accident.&lt;/p&gt;

&lt;p&gt;The term entries could be something like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Term 🇬🇧: main&lt;br&gt;
Term 🇫🇮: pää-&lt;br&gt;
Status: Preferred&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
&lt;p&gt;Term 🇬🇧: master&lt;br&gt;
Term 🇫🇮: isäntä-&lt;br&gt;
Status: Deprecated&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Languages are full of synonyms to choose from and termbases help with keeping track of those choices for consistent communication.&lt;/p&gt;

&lt;h1&gt;
  
  
  Not a jack of all trades but the master of some
&lt;/h1&gt;

&lt;p&gt;A translation memory is not the solution to everything, of course, but when you want to keep consistency in repetitive or continuously updated text types, its memory is definitely better than yours!&lt;/p&gt;

&lt;p&gt;&lt;small&gt;Cover photo by &lt;a href="https://unsplash.com/@jankolar?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Jan Antonin Kolar&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/database?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

</description>
      <category>translation</category>
      <category>localization</category>
      <category>tools</category>
    </item>
    <item>
      <title>CATs 😸 are the technical specialists in a translation company</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Sun, 01 Nov 2020 19:44:46 +0000</pubDate>
      <link>https://forem.com/minna_xd/cats-are-the-technical-specialists-in-a-translation-company-4j9b</link>
      <guid>https://forem.com/minna_xd/cats-are-the-technical-specialists-in-a-translation-company-4j9b</guid>
      <description>&lt;p&gt;In my introduction last week I briefly mentioned that I work as a "CAT" or localisation engineer. (Most of my career I've been a project manager, though.)&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/minna_xd" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F486874%2Fd53b80c0-5d80-40e2-8e66-64b2fa6579a6.png" alt="minna_xd"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/minna_xd/an-old-cat-can-learn-new-tricks-28e6" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;An old CAT 😺 can learn new tricks&lt;/h2&gt;
      &lt;h3&gt;Minna N. ・ Oct 23 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#intro&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#watercooler&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#welcome&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;What does one do? As opposed to a localisation engineer at the "source" (software development), at the translation company side I don't work with the actual code. I rely on the material sent to us by our customers. So, I would get translatable files such as .properties, .resources, .resx or .po for applications or, more commonly, documents like Microsoft Word/PowerPoint/Excel or Adobe InDesign and work on them.&lt;/p&gt;

&lt;p&gt;In a nutshell, I see my work as supporting project management and sales as a technical specialist.&lt;/p&gt;

&lt;h1&gt;
  
  
  At the beginning of a project (or for a quote)
&lt;/h1&gt;

&lt;p&gt;The work usually starts with a customer wanting to know the costs of some content they need translated. We'll have to figure out the amount of content (translations are often paid per source word) and also if any extra work (not included in translation rate) is needed.&lt;/p&gt;

&lt;p&gt;I would say the majority of the work is preparing various file types for translating in the translation tool. Even if you have a simple Word file, it may have translatable images or other embedded content that would need extracting before translation. If I come across uneditable images, I would check with the project manager if the customer wants us to prepare properly localised images or if they want to (limit costs and) just get the translations in, for example, a table format. If localisation is requested and my image editing skills are sufficient, I open the image in an editor, add text layers and make the original texts disappear. (If my skills are not sufficient, the images would be sent to other specialists.)&lt;/p&gt;

&lt;p&gt;Office productivity tools also often seem to get all sorts of flashy new features that help with the creation of the document itself but might hinder translation, especially since the translation tool will have to keep up with the features. We in localisation engineering have to make sure all content is properly extracted and doesn't break during translation. (And then fix, if something manages to break.)&lt;/p&gt;

&lt;p&gt;In software localisation files you usually have things like parametres or markup that I would check gets properly processed by the translation tool. Many file formats are quite standardised and, for example, the parametres would have little wiggle room in their appearance: &lt;code&gt;%s&lt;/code&gt;, &lt;code&gt;%d&lt;/code&gt;, &lt;code&gt;{0}&lt;/code&gt;... But then you might have others with more descriptive names or custom formats: &lt;code&gt;%PATH_TO_HEADER_IMAGE&lt;/code&gt;, &lt;code&gt;[user]&lt;/code&gt;. I would check that these are recognised as special content because it affects costs, special content is protected in the tool and therefore more difficult to mess up during translation, and the tool's QA can spot any errors quite easily.&lt;/p&gt;

&lt;p&gt;Localisation files can also have a custom structure where not everything is supposed to be translated so I'll have to tell the translation tool the specific bits that are edited.&lt;/p&gt;

&lt;p&gt;Take for example a JSON file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"menu"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"export"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"export"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Export"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"PDF"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"As PDF"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"TXT"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"As text file"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You mustn't translate the value for &lt;code&gt;id&lt;/code&gt; here but all the other content after a colon. You could either list all the properties that are translatable OR perhaps here you'd rather tell the tool what must not be translated.&lt;/p&gt;

&lt;p&gt;One of my favourite tasks is to write &lt;a href="https://en.wikipedia.org/wiki/Regular_expression" rel="noopener noreferrer"&gt;regular expressions&lt;/a&gt; to specify the translatable or protected content in a file. 😄&lt;/p&gt;

&lt;p&gt;The best approach to handle the files may vary from project to project.&lt;/p&gt;

&lt;h1&gt;
  
  
  At the end of a project
&lt;/h1&gt;

&lt;p&gt;When the translation is ready and reviewed, the files may need some post-processing before delivery. I would check the layouts of the documents and if images are localised, I'll edit their layout as well and insert them in the document. For proper DTP (desktop publishing) work we have other specialists but if DTP is done by the customer, I'd just quickly check everything's in order.&lt;/p&gt;

&lt;h1&gt;
  
  
  Administration or maintenance
&lt;/h1&gt;

&lt;p&gt;Sometimes I'm asked to do maintenance work on translation memories, or TMs (if you don't know what a translation memory is, don't worry! I'll tell you in a future post). As an example, we may get translation memory exports that need to be imported into our main TMs; there may be a document pair that should be aligned (source sentences are matched with translations, which is quite an easy job if you know the languages a little so you don't need a linguist do to that) and imported into a TM; or old file-based TMs need to be converted to server-based.&lt;/p&gt;

&lt;p&gt;I can also help with user management: I'll create new user accounts when needed and give instructions on how the translators can connect the tool to our server, or give additional access rights. Sometimes translators have problems connecting and I'll help troubleshoot that.&lt;/p&gt;

&lt;h1&gt;
  
  
  When things don't work
&lt;/h1&gt;

&lt;p&gt;Another common task in the job is troubleshooting. When a lot of people with different levels of technical prowess are using a tool in a hectic day-to-day work, you're bound to come across some interesting bugs and error messages (and sometimes the problem is between the keyboard and the chair, as they say). Sometimes I have helped with the same issue in the past so I know the steps to fix it, or a team member has documented the error and fix, but oftentimes the problem is all-new or the error message is very generic ("Object Reference Not Set to an Instance of an Object" 🙄). Then I'll usually check if I can replicate the issue and see how I can fix it or I'll search online in either the tool's knowledge base, which is quite good nowadays, or just any discussion forums. It's not uncommon that someone has already encountered the same issue!&lt;/p&gt;

&lt;h1&gt;
  
  
  What's that thing in the cover image?
&lt;/h1&gt;

&lt;p&gt;Back in the day, the translation memory software Trados required a physical dongle. You'd pop this in the back of your computer and fire up the software. Sometimes if you forgot to take the dongle with you, someone would pinch it and then you'd be looking for a spare one the next morning! 😄 This dongle here is my honorary parting gift from one of my closest colleagues as I just left the company after 15 (!!!) years.&lt;/p&gt;

&lt;h1&gt;
  
  
  In closing
&lt;/h1&gt;

&lt;p&gt;One of my favourite blogs on the topic is &lt;a href="https://multifarious.filkin.com/" rel="noopener noreferrer"&gt;Paul Filkin's 'multifarious'&lt;/a&gt;. He works for SDL who is the developer of a widely used translation management tool, SDL Trados Studio. SDL's product documentation is dreadful, to be honest, so whenever I search for more in-depth information on a feature, I usually find the answer in Paul's blog.&lt;/p&gt;

&lt;p&gt;Don't hesitate to ask if you'd like to hear more about something on this topic!&lt;/p&gt;

</description>
      <category>translation</category>
      <category>localization</category>
    </item>
    <item>
      <title>First time hacktoberfesting</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Sun, 25 Oct 2020 21:12:35 +0000</pubDate>
      <link>https://forem.com/minna_xd/first-time-hacktoberfesting-bb</link>
      <guid>https://forem.com/minna_xd/first-time-hacktoberfesting-bb</guid>
      <description>&lt;h2&gt;
  
  
  Progress
&lt;/h2&gt;

&lt;p&gt;I've finished my 4 PRs (plus one extra) and ordered my t-shirt yesterday. Can't wait to wear it! 😍&lt;/p&gt;

&lt;h2&gt;
  
  
  My contribution: translations!
&lt;/h2&gt;

&lt;p&gt;The idea of contributing code as such a newbie felt intimidating to me so I stayed in my comfort zone and decided to check if anyone wanted Finnish translations for their project. I began by looking for issues with the word 'translation' in them – and the hacktoberfest tag, of course.&lt;/p&gt;

&lt;h3&gt;
  
  
  OmniaWrite
&lt;/h3&gt;

&lt;p&gt;The first project that got me interested was &lt;a href="https://github.com/TorstenDittmann/OmniaWrite" rel="noopener noreferrer"&gt;OmniaWrite&lt;/a&gt;, a text editor engineered for creative writing. It's built with svelte and the localisation files are JSON. Easy peasy!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"header"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"write"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Write"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;(...)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The JSON is nicely organized and easy to follow while looking at &lt;a href="https://app.omniawrite.com/" rel="noopener noreferrer"&gt;the web interface&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There was a bit of a mistake with my very first PR because the Hacktoberfest introduction video failed to mention that you should refresh your fork from upstream before creating a PR. 😳 Luckily I didn't mess things up too badly and the maintainer resolved the conflicts on my behalf. Phew! After that faux pas, I carefully followed &lt;a href="https://digitaldrummerj.me/git-syncing-fork-with-original-repo/" rel="noopener noreferrer"&gt;this instruction&lt;/a&gt; before creating any more PRs.&lt;/p&gt;

&lt;p&gt;I haven't been able to test my translation yet because the stack is unfamiliar to me and I have no idea if I could test it, so I should probably look into that still...&lt;/p&gt;

&lt;h3&gt;
  
  
  Flexbox Froggy
&lt;/h3&gt;

&lt;p&gt;The next one was such a fortunate find! I've been going through Wes Bos's &lt;a href="https://flexbox.io/" rel="noopener noreferrer"&gt;What the Flexbox&lt;/a&gt; video tutorial so CSS Flexbox was somewhat familiar to me, and now I found a game where you solve puzzles using Flexbox! &lt;a href="https://github.com/thomaspark/flexboxfroggy" rel="noopener noreferrer"&gt;Flexbox Froggy&lt;/a&gt; is HTML+CSS+JS (my current faves ❤️) and the translations are grouped into three JavaScript files: docs, levels and messages.&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;var&lt;/span&gt; &lt;span class="nx"&gt;levels&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;justify-content 1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;instructions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;p&amp;gt;Welcome to Flexbox Froggy [...snipsnip...]&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;Here I was a bit worried about what would happen if someone else was adding another language at the same time, but it all went well. I think no one else was working on the files when I was, and I didn't mess up in Git either.&lt;/p&gt;

&lt;p&gt;Here a wonderful feature was the fact that my translations were viewable right away in my browser! Very easy to test and see that everything looked ok.&lt;/p&gt;

&lt;h3&gt;
  
  
  ScreenRuler
&lt;/h3&gt;

&lt;p&gt;Then I came across &lt;a href="https://github.com/Bluegrams/ScreenRuler" rel="noopener noreferrer"&gt;ScreenRuler&lt;/a&gt;, a configurable screen measuring tool for Windows. Written in C# which I know zilch about. No worries! The localisation file format RESX, on the other hand, is very familiar to me so, Challenge Accepted.&lt;/p&gt;

&lt;p&gt;The repo's issue description for adding translations is very useful because it explains the process well. There is also a tip about ResX Resource Manager to handle the translation work itself. The format of RESX is quite verbose and the tool helps to focus on the strings and not the format.&lt;/p&gt;

&lt;p&gt;I installed the stand-alone version first and translated the strings. The tool seemed a bit unstable because sometimes it just lost some of my translations here and there, but eventually I got all strings translated.&lt;/p&gt;

&lt;p&gt;Then I started wondering if I could test the translation because desktop applications can be tricky (space-wise etc.). Luckily I have a hubby who knows this stuff so I was able to set up Visual Studio with the project/solution, build the code and see the app localised. Looking good! The layout seemed to adapt to UI length dynamically, which was surprising.&lt;/p&gt;

&lt;p&gt;Visual Studio was an inconsistently-working pain in the butt, too (like the ResX tool), because sometimes the build process was a success and sometimes it threw weird errors that disappeared after a clean or, I don't know, after me just scratching my head a bit. 🙄&lt;/p&gt;

&lt;h3&gt;
  
  
  Grid Garden
&lt;/h3&gt;

&lt;p&gt;For my 4th PR I was a little lost. I searched for projects but a lot of them had loads of text to translate (e.g. 1000 English words is about half a workday for a professional Finnish translator) and some seemed abandoned. How lucky was I when Thomas Park of Flexbox Froggy tipped me to this other game, &lt;a href="https://github.com/thomaspark/gridgarden" rel="noopener noreferrer"&gt;Grid Garden&lt;/a&gt;. A game where you learn the CSS Grid layout! I knew nothing about Grid but was about to look into it after the Flexbox tutorial. Two birds with one stone this was: a PR for Hacktoberfest and learned me some Grid. 💪&lt;/p&gt;

&lt;p&gt;While doing my translations, I happened to notice something wonky about Vietnamese: the game has descriptions of each of the CSS properties and the possible values in Vietnamese were different from the original English. Therefore, I also created an issue for this repo and the original Vietnamese translator was able to fix the texts. Teamwork!&lt;/p&gt;

&lt;h2&gt;
  
  
  My extra PR
&lt;/h2&gt;

&lt;p&gt;At some point while working on the ScreenRuler translation, I noticed that a recent change in the code caused a crash when the user tried to open the in-app help. I beckoned my hubby to help again and I sent a super simple fix as a PR. The maintainer thanked me for noticing the bug and gave some great pointers about my too simple solution. Here came hubby again and we worked together on an idea I'd had all along (to check whether the help file for a specific language exists at all). I got to learn about some great IntelliSense features in Visual Studio, and how familiar the C# syntax is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;I had hoped to be able to use a translation memory tool for these translation tasks but I was unable to get some working. I tried MateCat and OmegaT but the JSON from Flexbox Froggy/Grid Garden failed to be recognized in MateCat (although JSON is supported) and there was something else I couldn't be bothered with in OmegaT. (I'm most familiar with SDL Studio and I just wanted to get working on the translations asap.)&lt;/p&gt;

&lt;p&gt;I did use &lt;a href="https://www.microsoft.com/en-us/language/search" rel="noopener noreferrer"&gt;the Microsoft Glossary&lt;/a&gt; which is a great resource for checking current translations in Microsoft products. For Finnish at least, you'll have to be careful with the suggestions, though, because there are some stupid and inconsistent ones. But at least it helps you find a translation when you sort of already know what you're looking for but just can't remember it right then. 😄&lt;/p&gt;

&lt;h2&gt;
  
  
  Reflections
&lt;/h2&gt;

&lt;p&gt;As mentioned, this was my first Hacktoberfest. I'm going to be honest and say I originally signed up for the swag but I ended up having a lot of fun, especially with the CSS games. I hope someone finds my translations useful and I'm curious to see if someone contributes improvements.&lt;/p&gt;

&lt;p&gt;I'm willing to contribute more translations to open source projects but I don't feel quite ready yet to contribute code. But I'll keep learning, and perhaps there are still issues with helpful tags like "good first issue" after Hacktoberfest ends.&lt;/p&gt;

&lt;p&gt;Look forward to next year's Hacktoberfest! Perhaps then I'll be brave and learned enough to tackle some code issues.&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
    </item>
    <item>
      <title>An old CAT 😺 can learn new tricks</title>
      <dc:creator>Minna N.</dc:creator>
      <pubDate>Fri, 23 Oct 2020 13:53:09 +0000</pubDate>
      <link>https://forem.com/minna_xd/an-old-cat-can-learn-new-tricks-28e6</link>
      <guid>https://forem.com/minna_xd/an-old-cat-can-learn-new-tricks-28e6</guid>
      <description>&lt;p&gt;I don't work in IT but I've been a localisation engineer and a translation &amp;amp; localisation project manager for 15 years. Minus 2.5 years on parental leave.&lt;/p&gt;

&lt;p&gt;During those 2.5 years, I genuinely started to think if I could be something other than a project manager. A project manager is the one who, in my mind, gives all the interesting tasks to someone else: in my case for example translation, review, testing, image editing, and desktop publishing. Mind you, I did some of those because I could, when I had the time.&lt;/p&gt;

&lt;p&gt;I've been making webpages with plain ol' HTML and CSS since about '95. I took IT as an optional subject at junior high and during that time I learned at least one useful skill (touch typing) and one interesting language (HTML). I hope it wasn't just the ignorance of our teacher that is to thank for sparking my fascination with HTML, but I remember being appalled that she would teach us to show text with a big margin on both sides by using &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; tags (when &lt;code&gt;&amp;lt;blockquote&amp;gt;&lt;/code&gt; had already been introduced). Back then, I don't think it showed the list bullet if &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; wasn't enclosed in &lt;code&gt;&amp;lt;ol&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; so the teacher got away with it. I knew better because I had been self-studying by reading a manual for Microsoft FrontPage I'd found in a bargain bin.&lt;/p&gt;

&lt;p&gt;Making webpages led to me writing a changelog. That led to me starting to babble about all sorts of things when I was supposed to be just writing short "news". That led to me looking into different blogging software and eventually starting a blog using Greymatter (Perl scripts generating static pages, anyone remember?). I can't remember what made me switch after only 6 months but right after GM I started blogging on WordPress – way before it was cool. (Movable Type was what was "cool". I took it for a spin. Yeeeah, not my platform.)&lt;/p&gt;

&lt;p&gt;On to programming languages. I ended up starting Language Technology studies (I prefer the name 'computer linguistics') in uni. Why? I liked languages but didn't want to end up a teacher or a researcher. I liked computers but for some reason didn't want to study "just" computers. As part of the compulsory studies I did take the basic studies in computer science and learned some Java and SQL. In my major studies I learned some Perl and Prolog – and by "learn Prolog" I mean managed to get my code working by trial and error. Java was fun-ish but I think it was written in a very basic text editor OR on paper (in exams). I did well on the basic course but nearly flunked the advanced.&lt;/p&gt;

&lt;p&gt;Fast-forward 17-18 years. I'm on maternity leave and want to rekindle my beloved hobby of web design (nearly withered away because of work and life in general although that's no excuse) and my smouldering interest in programming. I wish I remembered how, but I found the programming MOOC course at Helsinki University and took it at the beginning of this year. I realized that writing Java could actually be enjoyable and I was able to create something from scratch (a little game with textual UI first and then graphical). From there I've moved to other things and I find myself struggling to keep focus because there are so many interesting courses and technologies around. But, I aim to modernize my knowledge of HTML, CSS and web technologies in general.&lt;/p&gt;

&lt;p&gt;Back to localisation. I'm quite comfortable handling all sorts of localisation files (from RESX to PO, resources to properties, XML to JSON...) but I don't know how the localisation part is done code-side. That's one thing I wish to learn someday (and perhaps try to write some sort of learning journal here). I could also tell you about the localisation engineering side. I'm just about to move on to new challenges (albeit to project management again; baby steps...) at the beginning of November but I hopefully won't erase the past 15 years from memory right away.&lt;/p&gt;

&lt;p&gt;Happy to be here, and I hope to talk to you later!&lt;/p&gt;

&lt;p&gt;(CAT refers to computer-aided translation and we team members tend to call ourselves CATs. But I'm really a dog 🐶 person.)&lt;/p&gt;

</description>
      <category>intro</category>
      <category>watercooler</category>
      <category>welcome</category>
    </item>
  </channel>
</rss>
