<?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 Tom Hall on Medium]]></title>
        <description><![CDATA[Stories by Tom Hall on Medium]]></description>
        <link>https://medium.com/@thall1961?source=rss-484af3b4d4c3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*N1KMlM3qOzlgKNXjxl7YEg.png</url>
            <title>Stories by Tom Hall on Medium</title>
            <link>https://medium.com/@thall1961?source=rss-484af3b4d4c3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 21:43:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thall1961/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[Why You Need An MVP]]></title>
            <link>https://medium.com/@thall1961/why-you-need-an-mvp-b3f17f9a88c6?source=rss-484af3b4d4c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3f17f9a88c6</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[minimum-viable-product]]></category>
            <dc:creator><![CDATA[Tom Hall]]></dc:creator>
            <pubDate>Fri, 26 Apr 2019 15:04:05 GMT</pubDate>
            <atom:updated>2019-04-26T15:04:05.310Z</atom:updated>
            <content:encoded><![CDATA[<p>Ideas are nothing if they just sit in your head or in your idea journal. They worth as much as the used paper they’re on. Unless you get someone you don’t know to touch it and feel it and respond, it’ll never be worth anything and you’ll never know anything.</p><p>When building your MVP, focus wins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*rMmPmyKKcq5xbMKk.jpg" /></figure><p>Minimum viable products ( <a href="https://buildingyourideas.co/">in this case web apps</a>) save you time building a useless product in the dark, money blown on something nobody wants, and the precious momentum you need to launch.</p><p>It takes a special use case for this not to be true. That’s why this article focuses on 3 things:</p><ol><li>Know It: Make sure you know exactly what you want your app to do, ins and outs and everything.</li><li>Don’t Build Everything: Search for existing products that can supplement your app (either for now or forever)</li><li>Keep It Small: Building features means at least 3x more work.</li></ol><h4>Know Your Own Thing</h4><p>Ideas are kind of like the ocean tides. They are always evolving or growing or diminishing. When you pick your idea, then you have to work it like a ball of dough. You have to do some research to find out what’s out there already and if there’s really a need for what you want to do.</p><p>Let’s say you have some interest from people you’ve talked to and it looks like there’s nothing out there that is exactly what you want to do. (Side note — it’s okay if there is something out there that’s exactly the same. You just have to decide what you’re going to do better. Customer service? User experience? Cheaper? More expensive? Your idea doesn’t have to be unique, but it’s got to be better enough for someone to pay you and not them)</p><p>The more you know, the faster you can go and the more money you’ll save.</p><p>The clearer your vision is of how your app is going to work, the easier it will be to make some good progress fast. Find a friend that could just listen and ask questions to help you flesh out your idea. Write an article of what you think your app would be like and try to get people to read it. In my experience, people are too busy to steal your idea that doesn’t have any results.</p><p>The last bit I’ll say about this section is that you should also make a road map of features you think you want to build and where you want your app to go. There’s a good chance you’ll be wrong so don’t spend too much time thinking about this, probably one brain-storming session would be fine. But it’s good to have a general direction of where you think your app’s journey will go.</p><h4>Don’t Build Everything</h4><p>Developers try to build everything their MVP is going to need. That turns into a nightmare. There are already free ways to put a form on your site and collect information. There are already several free chat options to choose from. There are already free (or almost free) ways to be notified by text when someone does something. There’s already a ton of solutions out there that you don’t need to rebuild, and build it worse than they did.</p><p>Your job is to build the unique or better thing you have your sights set on.</p><p>With API’s you can link together pretty much everything you need and still be able to only focus on the part you’re going to focus on.</p><p>It’s going to take some discipline, especially if you can code, but make sure to now lose focus of what is going to make people think, “Oh ya, [your app] is so much better!”</p><h4>Keep It Simple</h4><p>When people haven’t thought about whatever idea you have for as long as you have, it takes them a minute to get it. I’ve seen this time and time again where the homepage “couldn’t be simpler” and visitors get stuck and leave because they don’t know what to do.</p><p>“My app is intuitive” is probably false. It needs to be so simple, a 7-year-old could figure it out. Because people are busy and the last thing they want to do is think when they get to your site or app. When using your app, people don’t want to search around for how to update their email preferences. Get a <a href="https://www.bluleadz.com/blog/the-benefits-of-faq-pages">FAQ page</a> up quick.</p><p>So this is kind of a tricky balance — keep it simple and make it intuitive. It requires you to know exactly what you’re going to offer right out of the gate and makes you stick to it. If a visitor to your website sees one benefit, then goes to your app and they can do a few things to help them realize that benefit, they will love your app.</p><h4>Wrapping Up</h4><p>So don’t go too fast. Don’t skip the step(s) of planning and sketching and reorganizing. Make sure your idea is clear and someone can understand what you have to offer, why they should use it, how they can sign up, and what to do to start using it. If you nail those, you’ll be golden.</p><p><a href="https://buildingyourideas.co/contact-form">Let me show you how.</a></p><p><em>Originally published at </em><a href="https://buildingyourideas.co/blog/why-you-need-an-mvp"><em>https://buildingyourideas.co</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3f17f9a88c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Power of Finishing…]]></title>
            <link>https://medium.com/@thall1961/the-power-of-finishing-a2f83b201955?source=rss-484af3b4d4c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2f83b201955</guid>
            <category><![CDATA[finisher]]></category>
            <category><![CDATA[lean-startup]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Tom Hall]]></dc:creator>
            <pubDate>Sat, 15 Dec 2018 23:22:27 GMT</pubDate>
            <atom:updated>2018-12-15T23:22:27.429Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*kxxoWvQN_PR56PJ5.jpg" /><figcaption>Photo by Tim Gouw from <a href="https://www.pexels.com/photo/blue-concrete-pavement-with-100m-sprint-paint-60230/">Pexels</a></figcaption></figure><p>…and the detriment of quitting too early.</p><p>Don’t get me wrong, I think quitting something dumb is a great idea 💡. And there’s a big difference between quitting and <a href="http://theleanstartup.com/principles#develop_mvp">pivoting</a>.</p><p>But what I mean is to start a coding project (could also apply to non-coding just as well) and get 75% of the way and then stop. I’ve done that lots of times and there’s no better way to burn out and kill your motivation than that.</p><h3>Quitting Too Early</h3><p>What I felt after jumping from one idea to another:</p><ul><li>lack of connection with the current project</li><li>lack of motivation to see the current project through</li><li>the weight of the previous project(s) still undone</li><li>the weight of time wasted, even though I’d rationalize that it was well spent because of the coding skills gained</li><li>defeated</li></ul><p>Usually, the projects that I couldn’t take over the finish line had something difficult (I mean, probably anything that adds value to someone else has a difficult piece to it that needs to be solved 🤦‍) and because of <strong>poor planning</strong>, that difficult spot would always be at the end, right before our hypothetical “launch” date.</p><p>I should add to that list a bit of shame. Whenever I’d bring up the project, I’d be proud at first that I got it most of the way, and then be ashamed when the answer to “Can I see it?” was always, “It’s almost done, you can see it in a little bit.”</p><blockquote>There’s nothing better than telling someone about a project, giving them a link, and letting them check it out for themselves.</blockquote><h3>Sticking With It</h3><p>So how can you avoid the baggage of projects left hanging?</p><ol><li>Plan out your project well</li><li>Get the MVP up and running</li><li>If you need a break, take it</li><li>Optimize and iterate till it rocks</li></ol><p>A bit more info about each of those…</p><p>1. Sometimes it’s hard to really anticipate what your app is going to need down the line, but you’re not building for that User yet. You’re building for user #1. You’re creating your M.V.P. (minimum viable product) to test if it has a place in the market and if it’s scalable (or another way I think about this one is if enough of the market will actually pay you for it). If you foresee a hard part, try building that first. I think you’ll thank yourself later.</p><p>2. If you’re building for fun, then just build it to get it live and in the hands of someone, even if that someone is you. Build it to get it working. I would say don’t even worry about performance optimization, efficiency, unused packages, or anything like that. Just get that sucker up and running.</p><blockquote>It’ hard to build something others can find value from. Start with the most basic version, get feedback, and iterate.</blockquote><p>3. Sometimes, at the end of getting a project live, you can be burnt out. It’s okay. Take a break, do some Yoga, go to your community pool. Get out and do something else that is totally different from coding. Just focus on something different enough to give your brain a chance to recoup. Maybe you won’t need a break, and that’s great too. Charge on!</p><p>4. Whether you still have the energy or you’re recharged, get back to your app. If you hate it and wish it were dead, then do with it whatever you want. BUT AT LEAST IT’S FINISHED! Or you can let it hang by itself and just see what happens.</p><p>But if you ARE into it still, then look at the pieces of your app and think about how you can do them better. This is a great time to reach out to more experienced developers and see what they’d do differently. You could <a href="https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github">open source</a> your work and then really see if others could bring something to the table. That has tons of benefits in it by itself 😉.</p><p>What I felt after a project was finished and live with User(s):</p><ul><li>proud — really happy that something I created was live and being used</li><li>calm because that bit of baggage was offloaded</li><li>smarter because I did it!</li><li>ready to share it with friends and other developers</li></ul><h3>Heroes get remembered, but legends never die.</h3><p>That has nothing to do with this (at least I don’t think so 🤔), I just like that quote.</p><p>Finishing a project is key to progression. It doesn’t matter how big or small the project is. What matters is that you follow through, learn, and have fun.</p><p>I’ve thought for a while to make something that could help with accountability and perseverance. Would you be into that?</p><p><em>Originally published at </em><a href="http://read.tomhalldev.com/2018/12/the-power-of-finishing.html"><em>read.tomhalldev.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2f83b201955" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning, Coding, & Freelancing as a Dad]]></title>
            <link>https://medium.com/@thall1961/learning-coding-freelancing-as-a-dad-7a817fe5461b?source=rss-484af3b4d4c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a817fe5461b</guid>
            <category><![CDATA[learn-to-code]]></category>
            <category><![CDATA[dadlife]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[career-change]]></category>
            <category><![CDATA[parenting-toddlers]]></category>
            <dc:creator><![CDATA[Tom Hall]]></dc:creator>
            <pubDate>Fri, 14 Dec 2018 22:09:31 GMT</pubDate>
            <atom:updated>2020-01-09T15:13:40.193Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*vQKxAAUIiZ-gU0KA.jpg" /></figure><p>I got married in 2012 at the age of 24. We had a kid in 2013, another one in 2016, and another one coming in Feb 2019. We moved 8 times. Learning to code and working on side projects from like 2 weeks to 8 weeks or so of a newborn’s life is really hard. I did it once and I’ll never do it again.</p><p>It’s tough to change careers, learn to code, and then improve enough to build good stuff. It’s even tougher when you have little kids.</p><p>And before I say anything else, I have to mention my wife Katie who has been the rock of our family since day 1. She’s put up with a LOT. Having someone like her is a huge blessing and a huge help.</p><p>I was going to put her picture in here but she just gave me the look of “don’t you dare.” 😅</p><p><em>So is it possible?</em></p><p>Yep, it is.</p><p><em>Is it hard?</em></p><p>Yep, it is.</p><p><em>Is it worth it?</em></p><p>Totally.</p><p>I started learning to code in Python at my Sr. Analyst job. But things didn’t really ramp up until I got a Jr. Web Dev job a few years later.</p><h3>What made the difference:</h3><ol><li>people were relying on my work</li><li>clear, defined tasks/projects</li><li>set of tools chosen for me*</li></ol><p>* If nobody is choosing for you, then just choose and go with it. Skills transfer well in the coding world</p><p>How can you duplicate this to learn from home?</p><ol><li>get together with another person wanting to learn and work together to get something in production</li><li>before you jump in, write down exactly what you want to build, generally what you want it to look like, and what you want it to do</li><li>just pick something and go with it (for me, it was Ruby on Rails)</li></ol><p>My real learning came when I got hired as a junior developer on a marketing team. Really all I had to do was build marketing websites, not even linked to marketing tools. But it was an amazing start because I had people who were relying on me. I had defined projects and set expectations. I had other people to ask how to do stuff. The last one I think was the least important for learners, you can get help from a lot of people across the world.</p><p>I started tinkering with code about 8 years ago. Since then, I’ve dabbled in Angular, <a href="http://www.electask.com/">built</a> stuff with Rails, <a href="https://cotd-zmkgrmssfm.now.sh/">jumped</a> into React, and have several projects underway.</p><p>So how did I learn to build and deploy stuff?</p><h3>Code At Night</h3><p>How do you learn to code and change careers with little kids?</p><p>The answer: harden up and get to it. If you’re not working towards building something, it’ll be the worst. If you are, it’ll suck a lot less.</p><p>That might be too harsh, but the trick is to just put in the hours. I would go to work, come home in the evening, help with the kids until they went to bed, and then start coding at 8 PM or so. This is when most parents start winding down to hit the hay.</p><p>The key to my learning was just doing it. I logged many, many late nights trying to figure out how to hook up Stripe Connect so my clients could accept money and I could strip a fee off the top.</p><p>If you want to learn how to code, it’s going to take a while. And that’s okay because you can build little stuff on your way to bigger, better stuff.</p><p>Make a version of Tic-Tac-Toe that you and a friend can try out. Build a real estate investment helper that pulls all the houses in a zip code and parses out the ones built in 1990 over 2000 square feet. Pull in tweets that have exactly your name in them.</p><p>And then build bigger stuff.</p><p>But where can you learn new stuff?</p><p><a href="https://wesbos.com/courses/">Online</a> <a href="https://testingjavascript.com/">classes</a> like those ones linked and tutorials. The main way I’ve learned how to code is building. I’m not a really good idea generator, but my friend is. So he’d throw out an idea and we’d try and build it. And we built a ton of stuff:</p><ul><li>a CRM and route manager for pest control companies</li><li>a route manager for garbage bin cleaning companies</li><li>an embeddable ticketing widget</li><li>an embeddable email capture widget</li><li>an election task manager</li><li>a bank account watcher</li><li>a mobile weather app</li><li>a book reading tracker</li><li>a smart SEO-centric blogging tool</li><li>an online store</li><li>a video player/course manager</li><li>and more that I can’t remember right now.</li></ul><p>All but a few of these projects are in production (on the web for anyone to see), which is another story altogether. 🙄</p><p><em>That was all in about 8 months. I went from not knowing how to send an email to have hundreds of people using my app in production.</em></p><p>Truthfully, there’s nothing really special about me or my brain. You can do it if you put your back into it. Sweat equity</p><p>The key to improving is to try and consume as much good development content as you can sustain. I like the word sustain on the end because you can listen to 10 eBooks in a weekend, but if you don’t keep practicing coding and trying out new things and looking up how professionals do it, most of that info will slip away and you won’t be a better coder.</p><p>Lessons Learned &amp; Keys To Improving</p><p>Practicing the right stuff will also make a big difference.</p><p><strong>Learn how to test your software.</strong></p><p>From 2010–2016, I wrote a grand total of 0 tests. I didn’t know how to test software other than running in the browser and pretending to be a user. Learning how to write good tests and really practicing writing tests will make a huge difference.</p><p><strong>Review apps you finish and see what you can learn from your own work</strong></p><p>This one is huge. You have a perfect opportunity to look over your own code and Google different parts of it. See if there’s a faster way to write that loop, or see if you even need that loop at all. Audit your packages and make sure you’re actually using them all. Get a better understanding of what that CSS library already has — maybe you’re duplicating classes. Optimizing your own work can be some of the best learning experiences you’ll have.</p><p><strong>Keep watching/reading tutorials and reading/listening to books by smart people</strong></p><p>These don’t have to be code-centric. They could be about business, marketing, sociology, networking, or whatever. Or they could be all about how to use React Hooks. Think about where you’re at, think about what is the thing that’s most out of whack or behind, and focus on that. What you focus on will change over and over and over again. So just think about what you need to work on the most, and do that. If many things seem tied as the worst, pick one and go with it. The most important thing is to keep going, keep consistently learning and trying.</p><h4>Speed Learning for Total Beginners</h4><ul><li>Jump right into a text editor</li><li>Don’t fear the editor. Jump right into a .html file, open it in the browser, and start trying stuff out. Try out what the difference CSS styles do. See what happens when you nest HTML elements (put one inside another).</li><li>Push your best thing live as quickly as possible</li><li>There’s something about having your project live that really inspires you to build more. Maybe it’s that now you have something you can share with other people. Whatever it is, I think having a project, a website, a blog you built live is important.</li><li>Keep consistently learning and developing</li><li>It can be hard to have other things come up. At the time of writing this article, I’ll have another kid in 2 months. Learning and developing will have to slow down for a bit. I tried developing through paternity leave and it was awful.</li><li>Iterate on your favorite project</li><li>Many times, you’ll figure out something you could build that can actually be a benefit to someone. While you’re still learning and trying out new things, I think a really good thing to do to progress is to have a look at your own work and see what could be improved. As stated earlier, it can be a delightful, productive experience</li><li>Join meetups and code groups</li><li>Looking at other experienced people’s code can be a huge benefit. Talking to them about how they did that in person can also be huge. This could also include conferences big and small.</li><li>Work on open source projects</li><li>Learning how to log an issue, implement the fix, create a pull request, and push your code up for review can be an unparalleled way to learn. You’ll get free feedback, sometimes from some of the world’s best developers. Where else could you get that?</li></ul><p>To wrap up, if you want to learn to code, you should chase that dream. It can be the best thing ever. Even if it just helps you think a different way, that could pay off big time in your non-coding job.</p><p>If you have kids and are dead at 8PM and don’t see how you could do it. Just go for it. If you get sick, take some Vitamin C, sleep when you can, and keep at it. It’ll be super hard and take a long time.</p><p>And you definitely should.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a817fe5461b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript — fetch() is cool ]]></title>
            <link>https://medium.com/@thall1961/javascript-fetch-is-cool-f48f1ab0ed18?source=rss-484af3b4d4c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f48f1ab0ed18</guid>
            <category><![CDATA[fetch]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Tom Hall]]></dc:creator>
            <pubDate>Thu, 06 Dec 2018 19:36:11 GMT</pubDate>
            <atom:updated>2018-12-06T21:50:17.996Z</atom:updated>
            <content:encoded><![CDATA[<h3>JavaScript — fetch() is cool 😎</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cabrQMeZHMpuGBsuMMYKng.jpeg" /></figure><p>Here’s a<a href="https://soapbox.wistia.com/videos/VrE8ENWSQ8"> quick video </a>of all that 👇.</p><p>If you’ve sent or received data from somewhere, you’ve likely used an XMLHttpRequest. Or if you’re a jQuery junkie, you’ve used $.ajax({ … }). An XMLHttpRequest looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/0*On3RpuHU-sRcTRIO.PNG" /></figure><p>Pretty simple, check the console for the time. I ran it 10 times on Chrome and got an average of ~ 0.394ms using <a href="https://developer.mozilla.org/en-US/docs/Web/API/Console/time">console.time()</a>.</p><h3>Now let’s look at fetch()</h3><p>The fetch() method is pretty simple. It only requires the path to the thing you want to fetch. In return, you get a promise that can be resolved to the response, telling you whether it worked or not.</p><p>If you were to just do this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/0*lBOtGjtOxrRWqJYc.PNG" /></figure><p>and displayed it somehow, you’d get [object Promise]. So after you evaluate the promise, you get the response object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/0*DqwVpjcwsvWNeXhn.PNG" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*iekRvHi9ljdDB8Ni.PNG" /></figure><p>The response body exposes a <a href="https://developer.mozilla.org/en-US/docs/Web/API/Response">ReadableStream </a>of the body contents. So how do you get the actual contents? You want <a href="https://developer.mozilla.org/en-US/docs/Web/API/Body/json">Body.json()</a>. The Body is actually a mixin that takes a Response stream, but we’ll talk about mixins another time. So the .json() function returns a promise that evaluates to the actual stuff you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/265/0*mU9x_gdUeMpp3a-A.PNG" /></figure><p>~ Mozilla example</p><p>So, to chain them all together, you can do something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/0*TGOvQZdta4A0aRoo.PNG" /></figure><p>If you haven’t used ansyc / await patterns, you should start now. You’re probably already pretty familiar with the async part, and the await part is pretty simple to understand at face value too.</p><p>Give a promise to await, and it’ll give you the fulfilled value.</p><p>When making a function async, you can use the await keyword to pause the execution of the function, pass it a promise (like what’s return from both fetch() and json()), and you’ll get what you want.</p><p>So, that chain above would look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/0*nnyuElMI2AADlD77.PNG" /></figure><p>One bummer — IE doesn’t support it. But there’s a <a href="https://github.com/github/fetch">polyfill from GitHub</a> that helps you out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*Zk10fQpqxzEpkUXZ.PNG" /></figure><p>So, fetch() is pretty great.</p><p><em>Originally published at </em><a href="http://read.tomhalldev.com/2018/12/javascript-fetch-is-cool.html"><em>read.tomhalldev.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f48f1ab0ed18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generator Functions in Javascript (function*)]]></title>
            <link>https://medium.com/@thall1961/generator-functions-in-javascript-function-d0ec520ed50f?source=rss-484af3b4d4c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0ec520ed50f</guid>
            <category><![CDATA[function-generators]]></category>
            <category><![CDATA[generator]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Tom Hall]]></dc:creator>
            <pubDate>Thu, 06 Dec 2018 17:56:24 GMT</pubDate>
            <atom:updated>2018-12-06T17:56:24.699Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hOitObdDgpP5r1BxJN7AyA.jpeg" /></figure><p>I was reading <a href="https://twitter.com/_ericelliott/status/1068284745887342592">Eric Elliot’s tweet</a> and saw something I didn’t know.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*LUS_y6VDRHCps9dr.PNG" /></figure><p>What was that function * (…)?</p><p>Turns out, that syntax defines a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*">generator function</a>. You can also create a generator function <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction">this way</a>, but the first is shorter, so we’ll stick with that for now.</p><p>Instead of returns, the generator functions have yield. And instead of running the whole function at once, you can exit it and return later.</p><p>This is what I mean:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*9qicmzlxNGWwxw5M.PNG" /></figure><p>We have a generator function called track. Then we assign it with the values 3 and 4 to the variable a. Then we can step through the yields using next() and log the value. This generator function is returning an iterator object. That’s how we can call next() on it. The next() method returns an object that has value and done. Like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/203/0*aG6x4Fkb9-lbj9Ke.PNG" /></figure><p>As you’d guess, done says whether that was the last yield or not, and value is what’s returned from the resolved expression. You can also use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield*">yield* </a>func1() to delegate the yield expression to another generator object. If you keep trying next() after the generator has finished, you’ll get:</p><p>value: undefined, done: true}</p><p>If you want to end the generator, put a return in there and it’ll end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*aiXbHJ3Kg615aO7r.PNG" /></figure><h3>Next, we’ll see how this fits in with async 💪</h3><p><em>Originally published at </em><a href="http://read.tomhalldev.com/2018/12/generator-functions-in-javascript.html"><em>read.tomhalldev.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0ec520ed50f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>