<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Larry Sass-Ainsworth on Medium]]></title>
        <description><![CDATA[Stories by Larry Sass-Ainsworth on Medium]]></description>
        <link>https://medium.com/@larry.sassainsworth?source=rss-f7bb2b014dde------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*AnfwgHi6tLtOhg4Q.jpg</url>
            <title>Stories by Larry Sass-Ainsworth on Medium</title>
            <link>https://medium.com/@larry.sassainsworth?source=rss-f7bb2b014dde------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 09:16:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@larry.sassainsworth/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Iterating over an HTML Collection in JavaScript]]></title>
            <link>https://medium.com/@larry.sassainsworth/iterating-over-an-html-collection-in-javascript-5071f58fad6b?source=rss-f7bb2b014dde------2</link>
            <guid isPermaLink="false">https://medium.com/p/5071f58fad6b</guid>
            <dc:creator><![CDATA[Larry Sass-Ainsworth]]></dc:creator>
            <pubDate>Sun, 05 Jan 2020 01:31:20 GMT</pubDate>
            <atom:updated>2020-08-02T19:58:32.455Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_z1geu732e7oS-W00J7igg.png" /><figcaption>One way to wrangle an HTML Collection</figcaption></figure><p>If you’re a web developer that works with JavaScript and you’re anything like me, chances are you’ve tried to use .map, .filter, or .forEach on an HTML collection and have been greeted with this friendly error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*X0lD6MjjbkBGqSfls1AyAA.png" /></figure><p>We can interact with an HTML Collection as if it’s an array in many other ways. We can use index numbers to access data. It <em>looks</em> like an array. But it functions a bit differently. First of all, a bit of a distinction. I’ve heard nodeList and HTMLCollection used somewhat interchangeably. They’re both DOM lists, but the only real difference is that HTMLCollection is more specific. It contains DOM elements that are the same, whereas a nodeList can contain a variety of DOM elements. That’s why querySelectorAll returns a nodeList but getElementsByTagName returns an HTMLCollection. Interestingly enough, forEach works on a nodeList but not an HTMLCollection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/0*DVEV3fIHeA_vfycw.gif" /></figure><p>There are a few different ways to iterate over an HTMLCollection. An obvious way that I haven’t mentioned so far is a for loop or a while loop. You can write these the same way that you would while iterating over an array:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*AomWCygJuyZl4Ks_SJ1dPg.png" /></figure><p>But if we want to map, filter or something along these lines we have to get a bit more creative. One thing that we can do, if we want to get extreme, is just add whatever function we want to the HTMLCollection prototype:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*wGaUhdtfrni0bv_jj3eJag.png" /></figure><p>This is pretty sloppy and can lead to issues down the line, especially when working on a bigger application. Another way is to convert our collection into an array using Array.from:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*khQOIwdNDKINS3dAQO_img.png" /></figure><p>Our HTMLCollection variable can now be iterated over like an array. If we don’t want to convert our HTMLCollection we can also use .call to use array methods:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*9A6DHQ0_pOdjzxZVqG1HiQ.png" /></figure><p>This is the cleanest of these methods in my opinion.<a href="https://ultimatecourses.com/blog/ditch-the-array-foreach-call-nodelist-hack">This is a blog that does into depth about why its not the ideal solution however.</a> Any of the above will work in a pinch, but its probably easiest to stick with for loops and write your own methods if you need to iterate over HTMLCollections. Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5071f58fad6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing a Queue using Stacks in JavaScript]]></title>
            <link>https://medium.com/@larry.sassainsworth/implementing-a-queue-using-stacks-in-javascript-fe78176ba028?source=rss-f7bb2b014dde------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe78176ba028</guid>
            <dc:creator><![CDATA[Larry Sass-Ainsworth]]></dc:creator>
            <pubDate>Sat, 28 Dec 2019 06:14:27 GMT</pubDate>
            <atom:updated>2019-12-28T06:14:27.550Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vlO53KXIZb92-iTN.png" /></figure><p>Continuing my series of writing blogs about things in JavaScript that are tricky to me initially, this is a blog explaining a simple way of building a stack using queues in JavaScript. Full disclosure: I was asked to do this in an interview, and am clearing some things up for myself and hopefully you as well.</p><p>We should start with the difference between a stack and a queue. They really aren’t all that different, both are data structures in which we only append elements, which is to say, we add them to the end. With stacks, we add items to the end and remove them from the end, but with queues we add to the end but remove from the beginning. This is often described by using the acronyms FIFO (First In, First Out) and LIFO (Last In, Last Out). This is why when implementing a stack in JavaScript, we can simply use an array. The pop and push methods are built in and have a time complexity of O(1). Queues are better suited for linked lists, but it’s a fairly common interview question to implement a queue <em>using </em>a stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*5UhCF--B7uVFDe0bYyAEuw.png" /><figcaption>How you might feel</figcaption></figure><p>This isn’t that hard if we remember that stacks in JavaScript are basically just arrays, and that the only big difference between a stack and a queue is the order in which we remove elements. How we get started is with two stacks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*L-KepEgxLdnM4M9OXMyJjA.png" /></figure><p>We are going to use these to shuffle around the elements so that we’re only using the push and pop methods to approximate the functionality of a queue. Our “enqueue” method, which just an even fancier way of saying append, which if you recall, is a fancy way of saying “add to the end” will just look like this at the start:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*K0WgJ-Ea4KLX64LCcxQSnQ.png" /></figure><p>Like a stack, or an array, we’re just adding elements to the end. However, when we want to “dequeue”, or remove elements from the beginning, we need to do the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*yRkVa75l_yjjRNmopU0ZPw.png" /></figure><p>We need to loop through all the elements of our first stack, pop them from the first array, then push them into the second array. Because we’re taking from the end of the first array and adding to the end of the second, when we pop from the second array, it will be like removing the first element of the first array. And like any good pop method it will have a return value of the element that’s being removed. If we want to dequeue sequentially this will also work because we’ll keep popping elements from the second array. However, if we want to enqueue again, our method right now is insufficient. We need to check if our elements are in the second array and if so, put them back in the first:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*G5PEVtIexlvbvXzMmKOZXQ.png" /></figure><p>This for loop will run only if stack2 is populated with our elements (because otherwise its length will be 0) and put them back in stack1 in the same way that we shuffled them around before.</p><p>Our final method, called “peek”, is used to check the first element in the queue. This is pretty simple:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*GgeG83S4M0eRFPpWWMS_Zw.png" /></figure><p>We just check if our elements are in stack1 or stack2, and return the first or the last element in the array, respectively.</p><p>And that’s all folks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe78176ba028" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hoisting in JavaScript]]></title>
            <link>https://medium.com/@larry.sassainsworth/hoisting-in-javascript-89436913df4?source=rss-f7bb2b014dde------2</link>
            <guid isPermaLink="false">https://medium.com/p/89436913df4</guid>
            <dc:creator><![CDATA[Larry Sass-Ainsworth]]></dc:creator>
            <pubDate>Sun, 22 Dec 2019 16:55:53 GMT</pubDate>
            <atom:updated>2019-12-22T16:55:53.464Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*fzBUOCO5f7lVJ1qc.jpg" /><figcaption>Hoist the sails!</figcaption></figure><p>In my last blog I went through the different ways of declaring variables in Javascript: Var, Let, and Const. If you were to read my blog, or any other source, something that will come up in your research is the idea of hoisting. I wrote about it but to be honest with you, dear reader, I did not fully understand it. One big correction from my last blog: all three variable types are hoisted, they are just hoisted differently. This all comes down to a misunderstanding of the variable declaration lifecycle on my part. The big takeaway is this: <em>declarations</em> are hoisted, initializations are not. These are two separate things occurring under the hood in JavaScript. I’ve seen a lot of blogs and tutorials gloss over this topic, so I thought I’d write it up a bit. This is a really helpful graphic that I found on a <a href="https://scotch.io/tutorials/understanding-hoisting-in-javascript">great blog on the subject by Mabishi Wakio</a> :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B0-BAcrHnMZgOBQF2qC6Ag.png" /></figure><p>Like I said above, with var, the declaration is hoisted but not the initialization. So code like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*orLXS3ktxKIywaGEOHdP_A.png" /></figure><p>Will output undefined. Because JavaScript will read the code like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*RS-YeY57brdI6HuT6sLOBw.png" /></figure><p>It hoists the declaration, but not the <em>assignment</em>. I had to break it down like this in order to understand it myself. The errors are really key to understanding what’s happening. For example, look what happens when with let:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MWy1lttcHJIdy2NRq3WiEA.png" /><figcaption>We get a reference error, instead of undefined.</figcaption></figure><p>With var, variable declarations are processed before any of the code is executed. Then initializations are read in order like the rest of the code. That’s why we usually declare and initialize simultaneously, and why a lot of people don’t know the difference. Similarly, this is why in ES6, let and const are not hoisted, to make sure that we always declare and initialize our variables at the beginning of our functions. So if you for the most part use let and const, you can pretty much go on as usual, but I think it’s helpful to have an understanding of what’s happening under the surface. Happy hoisting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89436913df4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let vs Var vs Const in Javascript]]></title>
            <link>https://medium.com/@larry.sassainsworth/let-vs-var-vs-const-in-javascript-8b898f868394?source=rss-f7bb2b014dde------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b898f868394</guid>
            <dc:creator><![CDATA[Larry Sass-Ainsworth]]></dc:creator>
            <pubDate>Sun, 15 Dec 2019 19:11:04 GMT</pubDate>
            <atom:updated>2019-12-15T19:11:04.076Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*2Iz9vcaOtPNivfen.png" /></figure><p>I learned JavaScript well after the introduction of ES6 and thus have mostly used the “let” and “const” keywords in JavaScript for variable declaration by example, following the coders around me. I was told not to use “var”, but wasn’t really told why. It’s a really common interview question though, so I’ve taken it upon myself to be the latest in a long line of people that write a technical blog on medium to explain something to themselves. Maybe you’ll get something out of it too!</p><p>Var declarations were the only type of variables before ES6, and Let and Const were introduced to fix some of its issues. The main differences with Var are its scope, its ability to be re-declared and updated, and the fact that it is hoisted. Now, as far as scope goes, var is globally scoped if it is declared outside of a function, functionally scoped if declared within one. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*DF4zwnOcCly8u-eAVaWPsg.png" /></figure><p>If pizza were declared outside of the function, we would have seen “delicious” and all would be right with the world. So far, this doesn’t seem like a big deal. But when combined with the fact that var can be redeclared, it‘s’ easy to see where things can get messy. If we can redeclare a var that’s globally scoped at any time, one small mistake could ruin otherwise perfectly good code. This is a big reason why let and const are preferred. Another little unique wrinkle about var is the fact that it’s hoisted. I’m not going to go super deep into hoisting, but for our purposes, it’s a pretty simple concept. Take this for example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*OqOxYFl0SfJrR-FsaXAmCQ.png" /></figure><p>We get undefined instead of an error, because variables declared with var are “hoisted” to the top of their execution context. This is not the case with let or const.</p><p>Let variables, unlike var, is block scoped, which means it scoped to a bunch of code surrounded by curly brackets. This can mean a function, or a loop or what have you. Another difference between let and var is that let can be updated, but not redeclared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*BKZip6S4kf1MybIKq4O4DQ.png" /></figure><p>This will not give us an error, but this will:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2c0K9bA4mhZN1WLC5rHJ_g.png" /></figure><p>This is the main difference between let and const. They’re both scoped the same, but const cannot be updated or redeclared whatsoever.</p><p>So just to recap, the main differences are: var declarations are globally or functionally scoped while let and const are block scoped. Var can be updated and redeclared, let can be updated but not redeclared, and const can do neither. Var is hoisted, while let and const are not.</p><p>That’s all folks! Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b898f868394" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Musical Scales With The Web Audio API]]></title>
            <link>https://medium.com/@larry.sassainsworth/creating-musical-scales-with-the-web-audio-api-b9dba3df67d?source=rss-f7bb2b014dde------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9dba3df67d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-audio-api]]></category>
            <category><![CDATA[music-technology]]></category>
            <dc:creator><![CDATA[Larry Sass-Ainsworth]]></dc:creator>
            <pubDate>Sun, 08 Dec 2019 18:32:18 GMT</pubDate>
            <atom:updated>2019-12-08T18:32:18.470Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*iJ3zg341N1F6zwHS.png" /></figure><p>I’ve been experimenting with the Web Audio API for a bit now, and <a href="https://medium.com/@larry.sassainsworth/creating-sounds-with-theweb-audio-api-14ec7e3d23a9">as I mentioned in my last blog</a>, there are tons and tons of built in ways to manipulate audio. I’m currently working on a project using handtrack.js, (<a href="https://medium.com/@larry.sassainsworth/getting-started-with-handtrack-js-ebd7c9d16c0">a hand tracking library that I also recently blogged about</a>), that takes in the coordinates of a hand being detected through the webcam and translates it to musical notes using Web Audio. It’s sort of a webcam theremin. I played around with lots of methods, controlling volume, using filters, there was one thing that was missing. The Web Audio API can take in just about any number, read it as a frequency in Hertz, and translate it to a musical tone, but if you know anything about music theory, you know that according to whatever musical scale you want to use, there are a finite number of notes. The Web Audio API doesn’t have anything out of the box that can create scales or tune your project to them, so I had to find my own way to figure it out. I couldn’t find a ton of information about this subject, so I hope that others making similar projects find this blog useful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*83sOCmnuTEqB5JBbldyD2Q.png" /><figcaption>Twelve Tone Scale</figcaption></figure><p>While I am a musician and know some music theory, I know little about the physics or technology of music. I knew right away that I wanted to tune my instrument to a twelve-tone scale, which is the standard tuning for most western instruments. If you look at the hertz frequencies of twelve tone scales it can be a bit confusing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*_PHGaYhFplTl3oDK.png" /></figure><p>But the equation for mathematically printing out a simple 12 tone scale is actually pretty simple. Musical scales are logarithmic. All you need is a starting frequency, and to multiply it by 2^(1/12). If we wanted a different tone of scale, all we’d need to do it change the base of 12 to something else. I used a while loop that can take in any starting frequency as an argument and return a 54 note scale:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*G09wFiRCGWqm4RxDJ_uhBw.png" /></figure><p>Then I used another while loop function to tune any note to this scale:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*Z6X2S6wRZwIVIU8XRgd-HA.png" /></figure><p>With my project, the scaleCreator function is attached to event listeners, so that a new scale is created and saved a “scale” variable whenever button is pressed. The autoTune function is being invoked any time a new tone is produced my hand movement. These functions were working quickly and well, but then I needed to move on to my next project: tuning my instrument to certain <em>keys, </em>like a real theremin or an autoharp. This part became a lot easier to lean on my previous knowledge of music theory, and all I had to do was tweak my scaleCreator function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*fM21u4JwkH4e2skQdgGiMw.png" /></figure><p>All we have to do is take in a chromatic scale, but only include notes that are at certain intervals. This is how I tweaked my scaleCreator function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*UHe5qJa7dr4p4tj8LREbYQ.png" /><figcaption>This will return an array of 96 notes in a major scale</figcaption></figure><p>I used a counter variable that keeps track of where the while loop is in a chromatic scale, and I’m checking the counter against an “intervals” variable to see if it matches the scale that I’ve selected. Now all I have to do is change the intervals and I’m able to generate any 12 tone musical scale under the sun! I hope this blog was able to help other aspiring Web Audio musicians, and stay <em>tuned</em> for more updates to my webcam theremin!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9dba3df67d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Sounds With theWeb Audio API]]></title>
            <link>https://medium.com/@larry.sassainsworth/creating-sounds-with-theweb-audio-api-14ec7e3d23a9?source=rss-f7bb2b014dde------2</link>
            <guid isPermaLink="false">https://medium.com/p/14ec7e3d23a9</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-audio-api]]></category>
            <dc:creator><![CDATA[Larry Sass-Ainsworth]]></dc:creator>
            <pubDate>Sun, 01 Dec 2019 19:23:02 GMT</pubDate>
            <atom:updated>2019-12-01T19:23:02.302Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*FQDnHhepDhFOQPhd.jpg" /><figcaption>A chart that will prove useful while learning how to use Web Audio</figcaption></figure><p>As someone who was a musician before I learned anything about computer programming, I’ve often wondered about ways in which I’d be able to connect the two disciplines. I’m happy to say that I stumbled upon the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API">Web Audio API</a>, an extremely versatile method for creating audio on the web with Javascript, developed by Mozilla. If you’re not familiar, the API can do a lot: it can play and manipulate sounds that you load, and it can even create its own sounds in a way that’s reminiscent of an analog synthesizer that works just about anywhere on the web, unless for some reason you’re still using Internet Explorer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n1D-C71RShzsE4I-ePqBmA.png" /><figcaption>Sorry, Internet Explorer</figcaption></figure><p>The synthesizer aspect of the Web Audio API sounded pretty cool and exciting to me right off the bat, and I’ve already had to learn so much about how synthesizers work and relearn a lot of music theory. If you’re anything like me, learning about this stuff can be an extremely deep rabbit hole. However, the purpose of this blog is just to get you started by showing the very basic first steps of creating an oscillating sound wave with the Web Audio API. While you can find some cool projects built with these tools, I had trouble finding much recent discussion of this topic on the web, save for <a href="https://www.the-art-of-web.com/javascript/creating-sounds/">this fun and interactive blog</a>, and <a href="https://teropa.info/blog/2016/08/10/frequency-and-pitch.html">this blog on frequency and pitch</a> that I found extremely informative. With no further ado, here is how to get started creating sounds with the Web Audio API! All you need is a JS file.You don’t even need to import anything!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*eHDf4Vvx-7LY7e5TtkepGg.png" /><figcaption>All you need to get started!</figcaption></figure><p>This is pretty much all you need to get started. Audio context is just establish a context for creating or playing sounds on a given web page. The oscillator variable is creating the oscillating sound wave itself in the given audio context. The frequency is not necessary to specify here, as it will default to 440 hz or a “middle A” note, but I’ve given it a frequency of 261.62, a middle C, as shown in the first image of this blog. The type of the oscillator is also not necessary to specify, though you have your choice of “sine”, “sawtooth”, “triangle”, and “square”. If you know anything about synthesizers, these options will sound familiar to you. If not, I’d recommend playing around with the different options! After that, all we need is to tell our oscillator to start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*jpZWCzBpKole9ZkbZQLAxA.png" /><figcaption>Pretty straightforward!</figcaption></figure><p>This can also take an argument of a time, to tell it to start after a certain amount of time. You probably want to attach this to an event listener of some kind, as many browses such as chrome aren’t crazy about letting you autoplay sounds. If you want to change the frequency at any point, we can use the following method:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-UHRT_hgMg8TV-zzG5WEeQ.png" /></figure><p>We can attach this to an event listener, or we could simply have the note change after a certain period of time. The above example is using audioContext.currentTime to, start right away. When we’re done we can just use the stop method:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*Ly7J-7ylqTgExH-cgo4oGQ.png" /><figcaption>Similarly, this can take an argument of a time if you want.</figcaption></figure><p>And that’s all you need to get started! Like I said, this can get extremely sophisticated. <a href="https://www.youtube.com/watch?v=-b42ITiQm6U">People have made entire synthesizer out of this thing</a>. And if you know a little web development, its easy to imagine this having all sorts of possibilities. I hope this blog was able to help people get started using the awesome Web Audio API!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14ec7e3d23a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started With Handtrack.js]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@larry.sassainsworth/getting-started-with-handtrack-js-ebd7c9d16c0?source=rss-f7bb2b014dde------2"><img src="https://cdn-images-1.medium.com/max/1856/1*6Xbqsmth0wLiUxrLnAlg3Q.png" width="1856"></a></p><p class="medium-feed-snippet">As a new web developer in 2019 who mostly works with Javascript, I&#x2019;m often envious of people that know Python. Specifically because Python&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@larry.sassainsworth/getting-started-with-handtrack-js-ebd7c9d16c0?source=rss-f7bb2b014dde------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@larry.sassainsworth/getting-started-with-handtrack-js-ebd7c9d16c0?source=rss-f7bb2b014dde------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebd7c9d16c0</guid>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[hand-tracking]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Larry Sass-Ainsworth]]></dc:creator>
            <pubDate>Thu, 21 Nov 2019 23:02:47 GMT</pubDate>
            <atom:updated>2019-11-21T23:02:54.474Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[The Wrong Way to Integrate Phaser With React]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@larry.sassainsworth/the-wrong-way-to-integrate-phaser-with-react-d85e3b226cf9?source=rss-f7bb2b014dde------2"><img src="https://cdn-images-1.medium.com/max/800/0*3wB2_-Pm6hcH0Ygt.png" width="800"></a></p><p class="medium-feed-snippet">For those of you that don&#x2019;t know, Phaser is a game framework developed by Photon Storm for making HTML5 games. It&#x2019;s incredible, and has a&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@larry.sassainsworth/the-wrong-way-to-integrate-phaser-with-react-d85e3b226cf9?source=rss-f7bb2b014dde------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@larry.sassainsworth/the-wrong-way-to-integrate-phaser-with-react-d85e3b226cf9?source=rss-f7bb2b014dde------2</link>
            <guid isPermaLink="false">https://medium.com/p/d85e3b226cf9</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[phaser]]></category>
            <dc:creator><![CDATA[Larry Sass-Ainsworth]]></dc:creator>
            <pubDate>Mon, 23 Sep 2019 04:25:43 GMT</pubDate>
            <atom:updated>2019-09-23T04:25:43.971Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[String Comparison In Javascript]]></title>
            <link>https://medium.com/@larry.sassainsworth/string-comparison-in-javascript-8f8aaed91bcb?source=rss-f7bb2b014dde------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f8aaed91bcb</guid>
            <category><![CDATA[unicode]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Larry Sass-Ainsworth]]></dc:creator>
            <pubDate>Wed, 04 Sep 2019 02:51:48 GMT</pubDate>
            <atom:updated>2019-09-04T02:51:53.760Z</atom:updated>
            <content:encoded><![CDATA[<p>This story begins with a bug. I was building a blackjack app in Javascript with my partner. Without getting into the multitudinous (and a little hard to program) rules of blackjack, it required a lot of comparing the values of cards to one another. For various reasons, our cards’ default values were always strings. While we obviously had to account for aces and face cards, for the most part our cards were comparing correctly. Even without converting their values to integers, our modest program knew that a “9” was higher than a “2”. Yes, before you say it: we should’ve used parseInt right away. But we didn’t. Everything was working fine. Until it wasn’t.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*H_gJIyP958E4luqLJKjD9g.png" /></figure><p>We started losing games against the computer when we were supposed to win and vice versa. But our program was perfect! Or at least pretty good. After a long period of careful debugging (shoutout to my partner Hamza!) we found the issue. On certain hands, our program thought that one hand was higher than the other one, even when it wasn’t. A little more console.logging and we realized <em>javascript</em> thought the same thing. “19” was greater than “8”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*9tvBkJTsPoICgmWC_UIDgA.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F7513882&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fumm-confused-wtf-blinking-okay-gif-7513882&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2F8884d639bb4ba11b6c36d737def17f2c%2Ftenor.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/d66bf17425bb52e143071912672a3941/href">https://medium.com/media/d66bf17425bb52e143071912672a3941/href</a></iframe><p>We did what any sane person would do: we started using parseInt everywhere, like we should have from the start, and we moved on. But that bug stuck with me, which leads me to this blog post. String comparison in javascript. How does it work ? Basically, it’s supposed to work lexicographically. Which is a way of saying it’s based on the order that letters appear in the alphabet. Makes sense.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*Voqskr04dfIig_Kb5UDlOg.png" /></figure><p>“b” is greater, because it comes later than “a” in the alphabet. Like how 2 comes after 1. If a string has multiple characters, it goes character by character.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*_5PVd6HpEvjh8DXStCsD1Q.png" /></figure><p>It’s by this same token that “19” is less than “8”! Javascript stops comparing after the second character, because “1” is less than “8”. Ok, I think I get it. Except there’s so much more. What happens if we compare stringified numbers to letters?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/212/1*PwTOHryE1NDDAWTqK6-5cA.png" /></figure><p>True! All numbers come after letters as far as javascrip is concerned. No matter the number of the letter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*EhPGq27mTOMl5Gf15p8Fmw.png" /></figure><p>Ok, I think I’m starting to get it! But there are some wrinkles. Like with capital letters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*4AWluuV1ict9lRmd3v0EQA.png" /></figure><p>And symbols.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*ZgLq2aOSrZhTSE_7Zz2wNA.png" /></figure><p>A little bit of digging, and I learned that this is because Javascript uses an internal encoding table called <a href="https://unicode.org/standard/WhatIsUnicode.html">Unicode</a>. It’s a character encoding standard that provides a unique number for every character on the planet, not limited to any individual human or programming language. And we are seeing it in action now! Pretty exciting right? Anyway, the takeaways are: unicode is great, javascript is confusing, and always use parseInt when comparing numbers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f8aaed91bcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Semicolons: Semi-necessary?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@larry.sassainsworth/semicolons-semi-necessary-17da25ad40f9?source=rss-f7bb2b014dde------2"><img src="https://cdn-images-1.medium.com/max/600/1*GUh9CNd6TEVUAkKuitaudw.png" width="600"></a></p><p class="medium-feed-snippet">I am new to javascript, and am still getting used to some of its basic syntax. When looking at example code, the first thing you notice&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@larry.sassainsworth/semicolons-semi-necessary-17da25ad40f9?source=rss-f7bb2b014dde------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@larry.sassainsworth/semicolons-semi-necessary-17da25ad40f9?source=rss-f7bb2b014dde------2</link>
            <guid isPermaLink="false">https://medium.com/p/17da25ad40f9</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Larry Sass-Ainsworth]]></dc:creator>
            <pubDate>Mon, 19 Aug 2019 13:04:39 GMT</pubDate>
            <atom:updated>2019-08-19T13:04:39.501Z</atom:updated>
        </item>
    </channel>
</rss>