<?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 Pau Pavón on Medium]]></title>
        <description><![CDATA[Stories by Pau Pavón on Medium]]></description>
        <link>https://medium.com/@paupavon?source=rss-33034029a855------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JSVMM0fJ9s2HT0_GhNJpcw.jpeg</url>
            <title>Stories by Pau Pavón on Medium</title>
            <link>https://medium.com/@paupavon?source=rss-33034029a855------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 18:42:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@paupavon/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[Deno: the future of Node?]]></title>
            <link>https://medium.com/front-end-weekly/deno-the-future-of-node-46f7daf9a61f?source=rss-33034029a855------2</link>
            <guid isPermaLink="false">https://medium.com/p/46f7daf9a61f</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Pau Pavón]]></dc:creator>
            <pubDate>Thu, 04 Jun 2020 00:07:17 GMT</pubDate>
            <atom:updated>2020-06-04T00:07:17.320Z</atom:updated>
            <content:encoded><![CDATA[<h4>Deno 1.0 launched a few days ago. What is it and, do you need to learn it?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*on-8GRkMIx3AIpHz_EV2vw.png" /><figcaption>Deno</figcaption></figure><p>On May 13th, Ryan Dahl and his team launched the first <em>stable</em> version of Deno, a “secure runtime for JavaScript and TypeScript”.</p><blockquote>Some guys launching a JS runtime, why should I care?</blockquote><p>Well. First of all, Ryan is the guy who created Node. That’s a pretty solid reason to start caring. Jokes aside, Deno has been under development for two years now, and its creators hope that it becomes a <strong>better version of Node</strong>. Ryan created the project to improve the stuff that Node didn’t handle quite well. And Deno is the result of these improvements.</p><p>Nonetheless, it is crucial to note that Deno is a completely different thing to Node. “It’s important to understand that Deno is not a fork of Node — it’s a completely new implementation”, in their own words.</p><p>It is also very important to take into consideration that the Deno team does explicitly not suggest that everyone should migrate their projects from Node. It might be a good choice for some applications to start doing so now, but for others not yet. We have to keep in mind, they say, that Node has been under development for more than 10 years now.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F788447%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F788447%2F&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/18214d8333adbb5668f31791a3202b60/href">https://medium.com/media/18214d8333adbb5668f31791a3202b60/href</a></iframe><p>With these considerations, let’s have a look at Deno’s top features:</p><h3>Security</h3><p>Deno is secure by default. You need to give it explicit permission so it can access files, the network, or the environment. It is therefore much more secure than Node, which can access everything by default.</p><h3>TypeScript support</h3><p>TypeScript is built-in. You can write your code in modern JavaScript without having to set up anything.</p><h3>Promises and async/await</h3><p>Deno supports top-level await syntax, so there’s no need to deal with wrapper async functions and Node’s callback hell.</p><h3>Modules</h3><p>Modules are not installed but rather imported from URLs.</p><h3>Deno, Dino, Deeno?</h3><p>And, most importantly, how is it pronounced? Well, judging from its logo, I guess “Deeno”. But if you hear Ryan, he calls it “Deno”. Whatever.</p><h3>Conclusion</h3><p>So, in light of the above, should you migrate all your Node projects to Deno? Well, probably not. Is this new runtime worth having a look? Surely yes.</p><p>I hope you enjoyed the reading, and if you did, let me know in the comments! Thank you very much 👍</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46f7daf9a61f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/front-end-weekly/deno-the-future-of-node-46f7daf9a61f">Deno: the future of Node?</a> was originally published in <a href="https://medium.com/front-end-weekly">Frontend Weekly</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dead-simple Loading Progress Bars with PACE.js]]></title>
            <link>https://medium.com/front-end-weekly/dead-simple-loading-progress-bars-with-pace-js-65ca59314b07?source=rss-33034029a855------2</link>
            <guid isPermaLink="false">https://medium.com/p/65ca59314b07</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-design]]></category>
            <dc:creator><![CDATA[Pau Pavón]]></dc:creator>
            <pubDate>Wed, 27 May 2020 13:21:25 GMT</pubDate>
            <atom:updated>2020-05-27T13:21:25.789Z</atom:updated>
            <content:encoded><![CDATA[<h4>My nightmare when I started web-dev, solved.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mUt6tXa4MPgZObeJ" /><figcaption>Photo by <a href="https://unsplash.com/@firmbee?utm_source=medium&amp;utm_medium=referral">William Iven</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>A few years ago, when I started coding, I remember unsuccessfully and desperately trying to code a progress bar in javascript for my website. I gave up.</p><p>Now, some years later, I’ve come across this library that does exactly this. I couldn’t help but share it with you.</p><h3>PACE.js — My lifesaver!</h3><p>So this is it. Several pre-made themes and customizable to your own will.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fIT1eLwP2IyAaQDh8VfqOg.png" /><figcaption>Some of the many PACE.js themes</figcaption></figure><p>Let’s quickly demonstrate how to implement it:</p><ul><li>Step 1: Grab your website</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nhgkYtjQ6GRLQB6okQCIYw.png" /><figcaption>A simple website containing only an h1 tag, as an example</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*1_PJjSO_bWS09MRiGUxz3w.png" /><figcaption>Code for the website</figcaption></figure><ul><li>Step 2: Get the JavaScript</li></ul><p>You can download the .min.js file from <a href="https://raw.githubusercontent.com/HubSpot/pace/v1.0.0/pace.min.js">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ovuxbdFUdDeifgeiHmSdvA.png" /><figcaption>JS pace.min.js file</figcaption></figure><ul><li>Step 3: Choose a theme and add CSS</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*7MdHxVA0T7a4ZWz_Sk_raQ.png" /><figcaption>CSS file with my theme of choice (Minimal)</figcaption></figure><ul><li>Step 4: Wire everything together</li></ul><p>Make sure to add the &lt;link&gt; tag to your CSS file and the &lt;script&gt; tag to the JS file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*O-gNlc1QOE4G7Dnuxo-jcg.png" /><figcaption>Everything wired together</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*1d6TVqOPs9zzbOSACj0e5A.png" /><figcaption>Final project tree</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F788447%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F788447%2F&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/18214d8333adbb5668f31791a3202b60/href">https://medium.com/media/18214d8333adbb5668f31791a3202b60/href</a></iframe><h3>Further uses</h3><p>PACE.js does not only detect page load but can be used to monitor the progress of AJAX calls as well. If you want to dig dipper, be sure to check the <a href="https://github.hubspot.com/pace/">documentation</a>!</p><p>I hope you enjoyed this super easy tutorial and that it was useful to you! 👍</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65ca59314b07" width="1" height="1" alt=""><hr><p><a href="https://medium.com/front-end-weekly/dead-simple-loading-progress-bars-with-pace-js-65ca59314b07">Dead-simple Loading Progress Bars with PACE.js</a> was originally published in <a href="https://medium.com/front-end-weekly">Frontend Weekly</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling form submissions in NodeJS]]></title>
            <link>https://medium.com/@paupavon/handling-form-submissions-in-nodejs-876bc980dc0a?source=rss-33034029a855------2</link>
            <guid isPermaLink="false">https://medium.com/p/876bc980dc0a</guid>
            <category><![CDATA[guides-and-tutorials]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Pau Pavón]]></dc:creator>
            <pubDate>Tue, 09 Oct 2018 19:57:53 GMT</pubDate>
            <atom:updated>2018-10-09T19:57:53.368Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Dt4Naa7ZvleyPa2A" /><figcaption>Photo by <a href="https://unsplash.com/@cebbbinghaus?utm_source=medium&amp;utm_medium=referral">Christopher Robin Ebbinghaus</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Although the above photo looks astonishing, it has got nothing to do with the topic of this little guide. But it looks cool anyway.</p><p>Moving onto the main thing, the purpose of this article is to show how you can handle form submission in NodeJS. Forms are an essential part of many websites, let them be for registration, login, maybe search engines with some kind of filtering parameters… Knowing how to implement them is, as I see it, really, really important.</p><p>One thing to note is that I am assuming that you have a basic understanding of Node and routing in Express. If that is not the case, you can check my article on <a href="https://medium.freecodecamp.org/really-really-basic-routing-in-nodejs-with-express-d7cad5e3f5d5">basic routing in NodeJS with Express</a>.</p><p>Without more delay, let’s begin:</p><p>First and foremost, we need to set up the project folder with <em>npm</em> (node package manager) and install the following dependencies:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*rDx1FnUrcdRolWZhg0J-rg.png" /><figcaption>package.json</figcaption></figure><blockquote>body-parser: request parsing</blockquote><blockquote>express: routing</blockquote><blockquote>pug: template engine. You can either use this one or any other of your choice</blockquote><p>With that done, let’s configure the server and a single route (for the moment):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*Z1zGj5z0KyhG3e8xdCJRdw.png" /><figcaption>app.js</figcaption></figure><p>We set the view engine to <em>pug</em> and listen to port 3000. Whenever someone sends a GET request (aka connects to the server), the <em>index.pug</em> file is rendered. We will have to create this file under the views folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*QCtjhNIOOf1iEbydcKPamw.png" /><figcaption>Project structure</figcaption></figure><p>And in here is where out HTML code goes. Pug is a bit different from plain HTML, but I am sure you will be able to understand what is going on. If not, you can always use another template engine such as <a href="https://www.npmjs.com/package/ejs">EJS</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*tFfZ5ce-mBHvHg7-cvoJog.png" /><figcaption>index.pug</figcaption></figure><p>We are using the <a href="https://bulma.io/">Bulma CSS framework</a> for styling purposes. This is completely optional and doesn’t affect the form submission at all, but the overall project will be more visually appealing if we use it.</p><p>The view now looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G7zCY_P31zaf4B6yOyRyyA.png" /><figcaption>index.pug rendered in Chrome</figcaption></figure><p>We are now done with the frontend and can view our page with its form. When we click submit though, we get a <strong><em>“Cannot POST /submit”</em></strong> error. That is because we haven’t handled the POST request yet. To do so, first we need something to parse the information coming along with the form, so we can access and use it later. That is were body-parser comes into action:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*Tbi2qzv2xvgn0tS8BReUTA.png" /><figcaption>app.js</figcaption></figure><p><em>bodyParser.urlencoded</em> will ceate a request body object (req.body) where the information from our form submission is stored. We can now create the POST route:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*vzBwUOPJd0hXW4gw2dumsQ.png" /><figcaption>app.js</figcaption></figure><p>Form fields are accessed by the same name property in the HTML or Pug code. To access the <em>username</em> value for instance, we simply do <em>req.body.username</em>.</p><p>The code above console-logs the value of both fields in the form. From now, you can store the values in a database or do whatever you wish with them.</p><p><strong>Last but not least, let’s see it in action!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dzP1RXB3X9d7AtuEPgCWqQ.gif" /><figcaption>Submitting the form</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/143/1*WYfWbY3TaV0y5GbE5W2TYA.png" /><figcaption>Output in console</figcaption></figure><blockquote>It works perfectly fine!</blockquote><p><strong>If you enjoyed this mini guide, please 👏 and ⌨️ below. I really appreciate it! 😄</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=876bc980dc0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create a syntax theme for Atom]]></title>
            <link>https://medium.com/free-code-camp/how-to-create-a-syntax-theme-for-atom-8a93c43dd35e?source=rss-33034029a855------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a93c43dd35e</guid>
            <category><![CDATA[atom-text-editor]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Pau Pavón]]></dc:creator>
            <pubDate>Sun, 10 Jun 2018 07:38:13 GMT</pubDate>
            <atom:updated>2018-06-10T07:38:13.350Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xeInmnLOqxbhpVkc" /><figcaption>Photo by <a href="https://unsplash.com/@der_maik_?utm_source=medium&amp;utm_medium=referral">Maik Jonietz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Oh, Atom! Such a beautiful code editor. Probably one of its greatest features is the wide range of options to customize it (with packages and themes created by Atom developers and, specially, the community around it).</p><blockquote>Wh-what have I just heard?</blockquote><p>Do you want to learn how to create your own syntax theme? You’ve come to the right place!</p><p>Follow my in this little guide if you want to hack your editor to your liking! (Or you could maybe just check <a href="https://flight-manual.atom.io/">Atom’s flight manual</a>, which probably explains it better. Or not. Who knows?)</p><p>It is to say that it would be good that you knew LESS before beginning the creation of your theme. That’s because all the files are not written in plain CSS but using this tool.</p><p>If you don’t know LESS, no worries. The main thing with it are variables, and I googled that and learnt everything I needed in about 30 seconds. It shouldn’t take longer.</p><p>STEP 1 — Install Atom</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INSkfLlUjgKyfTuM4_opfw.png" /><figcaption>Official Atom page (<a href="https://atom.io/">atom.io</a>)</figcaption></figure><p>It’s always important to mention everything. This is a key step. Do not forget it.</p><p>STEP 2 — Generate a new syntax theme</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dl2Cqyf18XPxfKa0Tym9jg.png" /><figcaption>Type “Generate Syntax Theme” in the command palette</figcaption></figure><p>Press Cmd+Shift+P (MacOS) or Ctrl+Shift+P (Windows) top open up the command palette, and start typing “Generate Syntax Theme”. As soon as this option appears, select. Name it whatever you want (although according to the Atom flight manual, syntax themes should end with <em>-syntax</em>) and save it somewhere on your computer.</p><p>At this point, I recommend you open up Atom in dev mode (by selecting View &gt; Developer &gt; Open in Dev Mode), in order to be able to see the changes you make in your theme in real-time. You also need to go to the <em>Settings</em> and under the <em>Themes</em> tab choose your new syntax theme from the dropdown menu.</p><p>STEP 3 — Know your files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*76yXVADpVz5hFOfK-9Durg.png" /></figure><p>There are three files you want to edit: <strong>base.less</strong>, <strong>colors.less</strong> and <strong>syntax-variables.less</strong>. You may also want to edit <strong>package.json</strong> in case you are thinking of publishing your theme.</p><ul><li>colors: this is where you define all the colors you want to use in your theme. You create a variable for each and every one of them and that’s it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DHT6iy-s4wSBcZII6JgvJQ.png" /><figcaption>colors.less (default)</figcaption></figure><ul><li>syntax-variables: these are all the variables that must be included in your theme. You set them to whatever color in your <strong>colors.less</strong> file you want to.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MVAC-ra7QSEWgbIPeI2kAA.png" /><figcaption>syntax-variables.less (default)</figcaption></figure><ul><li>base: this is more kind of general settings. I’ll recommend just reading and setting every property to either a variable in your <strong>colors.less</strong> or in <strong>syntax-variables.less</strong> file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wcwiyiYZ_2mSPgAOHE2tAg.png" /><figcaption>base.less (default)</figcaption></figure><ul><li>package: package.json, as you may already know, just tells information about your theme. If you want to publish it, you must change it including all relevant information. More info on that in the <a href="https://flight-manual.atom.io/hacking-atom/sections/publishing/">Atom’s flight manual publishing section</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KkL40fokzTl8CyV08i9cWg.png" /><figcaption>package.json (default)</figcaption></figure><p>STEP 4 — Start customizing!</p><p>Now, the only thing remaining is applying your creativity and color-knowledge to make Atom even prettier than it is!</p><blockquote>Happy customizing!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a93c43dd35e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-to-create-a-syntax-theme-for-atom-8a93c43dd35e">How to create a syntax theme for Atom</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A quick introduction to TensorFlow.js]]></title>
            <link>https://medium.com/free-code-camp/a-quick-introduction-to-tensorflow-js-a046e2c3f1f2?source=rss-33034029a855------2</link>
            <guid isPermaLink="false">https://medium.com/p/a046e2c3f1f2</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Pau Pavón]]></dc:creator>
            <pubDate>Thu, 24 May 2018 18:22:49 GMT</pubDate>
            <atom:updated>2018-07-31T09:40:38.716Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TqGRmDuim8mReF9m." /><figcaption>Photo by <a href="https://unsplash.com/@grohsfabian?utm_source=medium&amp;utm_medium=referral">Fabian Grohs</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>TensorFlow has been around for a while now. Until last month, though, it was only available for Python and a few other programming languages, like C and Java. And you might think those would be more than enough.</p><p>I had heard of TensorFlow in the past. Even though I didn’t know anything about machine or deep learning, I was pretty sure it was one of the most used frameworks for those purposes. I had seen lots of cool things done with it: object detection in images, speech recognition, and even music composition!</p><p>Imagine being able to do all these cool ML things in the browser, without installing any libraries and having to compile all those lines of code again and again. Well, that’s what TensorFlow.js has come to do.</p><p>If you want to learn more about how and why this amazing framework has come to life, you can check out <a href="https://medium.com/u/b1d410cb9700">TensorFlow</a> here on Medium!</p><p>So as soon as I discovered this, I wanted to start learning how TensorFlow.js works. And that’s exactly what I’ve started to do: I’ve found <a href="https://www.youtube.com/playlist?list=PLRqwX-V7Uu6YIeVA3dNxbR9PYj4wV31oQ">a set of tutorials by The Coding Train on Youtube</a>, which are still ongoing (in fact, they’ve just started) and I’ve began to mess around a bit with things.</p><p>I’d like to give you a quick introduction to TensorFlow (TF) so you can follow me along my journey and learn with me.</p><h3>The basics of TensorFlow.js</h3><p>Let’s get started! First of all, you should know that all the documentation is on <a href="https://js.tensorflow.org/">TF’s website</a>, under the API Reference section.</p><blockquote>But wait, why is it called TensorFlow? What even is a tensor?</blockquote><p>Glad you asked. A tensor is basically a structure of numbers. In math, there are different ways of representing numbers. You can have just the number itself, a vector, a matrix, and so on. A tensor is just a general term for all these different representations of data.</p><p>In TF, tensors are differentiated because of their <strong>rank</strong>, or, in other words, the number of <strong>dimensions</strong> they have.</p><p>These are the most common ones:</p><h4>Scalar (rank-0)</h4><p>Just a number. This is how you can create and console-log one:</p><pre>tf.scalar(4.5).print();</pre><p>And the output is the following:</p><pre>Tensor<br>  4.5</pre><h4>Tensor1d, tensor2d, tensor3d and tensor4d (rank- 1, 2, 3 and 4 respectively)</h4><p>These are higher dimensional tensors. If you wanted to create a rank-1 tensor, for instance, you could simply do:</p><pre>tf.tensor1d([3, 7, 8]).print();</pre><p>Which would output:</p><pre>Tensor<br>  [3, 7, 8]</pre><h4>Tensor (rank-n)</h4><p>If you don’t know the dimensions of your tensor, you can simply create one with the following function (notice how the above two examples work just as well with this other method):</p><pre>tf.tensor(4.5).print();<br>tf.tensor([3, 7, 8]).print();</pre><p>This outputs exactly the same as before.</p><p>You can, additionally, pass a couple more parameters to these functions.</p><h4>tf.tensor(values, shape?, dtype?)</h4><p>Let’s look at <strong>values</strong> first. This is the only compulsory parameter, and the only one we’ve been passing on in the previous examples. You can either pass a flat array of values (or even a single number in scalars) and specify the shape yourself, or you can pass a nested array.</p><p>Now you might be wondering what <strong>shape</strong> is. So, let’s say you want to output the following tensor:</p><pre>[[1, 5],<br> [4, 7]]</pre><p>That is, you guessed right, a 2x2 matrix. You can either create this tensor by passing a flat array and specifying the shape as the second parameter of the function</p><pre>tf.tensor([1, 5, 4, 7], [2, 2]).print();</pre><p>or by passing a nested array</p><pre>tf.tensor([[1, 5], [4, 7]]).print();</pre><p>Lastly, we have <strong>dtype</strong>. This specifies the data type. As for now, <strong>int32, float32</strong> and <strong>bool</strong> are the three supported types.</p><h4>Operations</h4><p>But, what can you do with these tensors? Well, among other things, you can perform mathematical computation on them, such as arithmetic operations:</p><p><strong>Note</strong>: the following operations are performed element-wise, which means that every term of the first tensor involved is associated with the term in its same place in the other tensor.</p><pre>const a = tf.tensor1d([4, 7, 2, 1]);<br>const b = tf.tensor1d([20, 30, 40, 50]);</pre><p>There are two ways these two can be added:</p><pre>a.add(b).print();</pre><p>or,</p><pre>tf.add(a, b);</pre><p>Both output:</p><pre>Tensor<br>  [24, 37, 42, 51]</pre><p>Here’s how they work for subtraction,</p><pre>tf.sub(a, b).print();</pre><pre>Tensor //output<br>  [-16, -23, -38, -49]</pre><p>multiplication,</p><pre>tf.mul(a, b).print();</pre><pre>Tensor //output<br>  [80, 210, 80, 50]</pre><p>and division:</p><pre>tf.div(a, b).print();</pre><pre>Tensor //output<br>  [0.2, 0.2333333, 0.05, 0.02]</pre><p>It’s pretty simple and straightforward.</p><h3>Try it yourself!</h3><p>If you haven’t already, I encourage you to try the above yourself. This is the most basic stuff in TF, but these concepts are key in order to understand the more complex (and more fun) parts of it.</p><p>Thanks for reading!</p><p>Edit: Check out <a href="https://medium.com/u/a8ae39d4d401">ADL</a>’s <a href="https://www.youtube.com/playlist?list=PL1jmMFbLDfgX0Q-rBbfoBdNFl8MS3kTh9">Youtube playlist</a> on TensorFlow, I’m sure it’ll help you out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a046e2c3f1f2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/a-quick-introduction-to-tensorflow-js-a046e2c3f1f2">A quick introduction to TensorFlow.js</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What I learned when I took an entrepreneurship class at age 14]]></title>
            <link>https://medium.com/free-code-camp/what-i-learned-when-i-took-an-entrepreneurship-class-at-age-14-7e551071242a?source=rss-33034029a855------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e551071242a</guid>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Pau Pavón]]></dc:creator>
            <pubDate>Mon, 14 May 2018 15:52:18 GMT</pubDate>
            <atom:updated>2018-05-14T15:52:18.571Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2HyvdDloOey6xGVZ." /><figcaption>“A workplace with countless rows of desks.” by <a href="https://unsplash.com/@frantic?utm_source=medium&amp;utm_medium=referral">Alex Kotliarskyi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Last year, I made one of the best decisions of my life.</p><p>At school, I had to choose one of three subjects: French, classic culture, or Entrepreneurship. I didn’t know what the last one was all about, so I joined in.</p><p>I was told it would be something “about business” and stuff like that. It sounded good, but nothing too exciting. Oh, was I wrong: it turned out to be <strong>awesome</strong>. We had this class twice a week, and I remember looking forward to it every single day.</p><p>The goal of the subject, ultimately, was to build a project or a service that answered a need in society.</p><p>Before and while doing that, we learned some (very useful) concepts which are essential to setting up a business, like defining the value proposition(s), evaluating costs and revenue streams, and so on. Overall, we learned how to make our own business model canvas, which I now believe to be key when building or trying to understand any business.</p><p>Despite the usefulness of this knowledge, that wasn’t the best part. What ended up being better — way better — was what I would learn on my own.</p><p>As I said, taking the class itself was great. But I wasn’t satisfied with what I was taught in it: I wanted more. I began googling and youtubing (is that even a word??) and eventually got really, really interested in entrepreneurship.</p><p>And that’s really the point I want to make in this article. Entrepreneurship is a passion for a lot of people, just as writing, engineering, sports, and art are for others. So I’ve been wondering: why isn’t it a subject that most schools teach? Not only may you find your passion, but entrepreneurship classes come with plenty of other benefits as well.</p><p>Here are some lessons I learned, both from my class and from working through problems on my own.</p><h3>Entrepreneurship enhances creativity and boosts innovation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8fI6Q-OsD9JcMz0I." /><figcaption>“A round light bulb giving off warm light” by <a href="https://unsplash.com/@aindraus?utm_source=medium&amp;utm_medium=referral">Anthony Indraus</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Being creative and innovative is something inside ourselves that needs to be developed. It’s only through putting these abilities to work that you can improve them. It’s undeniable that entrepreneurship requires both skills, so they’ll get used and improved along your way.</p><h3>You learn to listen to others and value their ideas/points of view</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Er5EhrLS_poGRHel." /><figcaption>“A group of people brainstorming over a laptop and sheets of paper” by <a href="https://unsplash.com/@cikstefan?utm_source=medium&amp;utm_medium=referral">Štefan Štefančík</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Working with your team in order to get something done is essential. People naturally excel in different subjects. If you accept that fact and learn to use it to your advantage (the team’s advantage), the end product, service or whatever project you’re working on will turn out really well.</p><h3>You get to think about the problems society is facing today</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sFEOPAA66t72HOVQ." /><figcaption>“A teenager looks out the window with a hand on mouth and elbows on the railing.” by <a href="https://unsplash.com/@chalis007?utm_source=medium&amp;utm_medium=referral">胡 卓亨</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When choosing what we wanted to develop, we had to find a need or a problem in society that we wanted to solve. It’s very likely that you don’t think about this every single day, and trying to do so can even be difficult at first. Once you get into the flow of it, though, you start to realise that there are tons of things that can be solved or improved. You also become aware of a lot of problems you hadn’t ever thought about.</p><h3>Your team needs to chase an end goal</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*840g-FJUhsvgeCJe." /><figcaption>Photo by <a href="https://unsplash.com/@goian?utm_source=medium&amp;utm_medium=referral">Ian Schneider</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Combining the above three, you finally set yourself and your team an objective and start working towards it. I believe that this is essential, not only in business/school related matters but in life in general. Having clear goals you’re passionate about makes it easier to realise your dreams and fulfill your aspirations in any field.</p><p>And, at the end of the day, that’s what I think entrepeneurship is about. It’s about making other people’s lives better while you improve yours as well. It’s about giving, receiving, hearing and being heard, and, overall, loving the work you do.</p><blockquote>I hope you liked my story, and I’d really like to read your opinions on entrepreneurship being taught at school. Thanks for reading!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e551071242a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/what-i-learned-when-i-took-an-entrepreneurship-class-at-age-14-7e551071242a">What I learned when I took an entrepreneurship class at age 14</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Really, really basic routing in Node.js with Express]]></title>
            <link>https://medium.com/free-code-camp/really-really-basic-routing-in-nodejs-with-express-d7cad5e3f5d5?source=rss-33034029a855------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7cad5e3f5d5</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[routing]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Pau Pavón]]></dc:creator>
            <pubDate>Tue, 03 Apr 2018 04:19:40 GMT</pubDate>
            <atom:updated>2018-04-03T04:20:26.707Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FWsvE-8X-T1wNDj5." /><figcaption>Photo by <a href="https://unsplash.com/@clemhlrdt?utm_source=medium&amp;utm_medium=referral">Clément H</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The goal of this story is to briefly explain how routing works in Express while building a simple — very simple — Node app.</p><p>We’ll also use EJS, a template engine that “lets you generate HTML markup with plain JavaScript,” according to <a href="http://ejs.co/">their website</a>. Basically, it’ll let us create HTML pages that can vary depending on the request the client makes. We won’t be using this last feature, but it’s a great one. At the end of this article, you’ll find some resources where you can learn more.</p><h3>What is routing? (In 2-ish lines)</h3><p>First of all, let’s take a quick (really quick) glance at what routing is:</p><blockquote>somewebsite.com/someroute</blockquote><p>It’s basically taking the user (or some data) from one place to another. That place is the route. I told you I was going to make it quick.</p><h3>Creating the project</h3><p>We’re going to build a fancy website to learn how routing works in Express. Check it out:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wO7-ggTvX9J49zDJEzKNTw.png" /></figure><p>Cool, right? But it’s everything we need for the moment.</p><p>First, let’s create the project and install the packages. Just run the following in the command line:</p><blockquote>npm install express</blockquote><blockquote>npm install ejs</blockquote><p>You can additionally add the <em>dash dash save</em> (I write — as “<em>dash”</em> because Medium automatically formats it, and it doesn’t look well for this purpose) to save it in your <em>package.json</em> file. But how this works is a story for another day.</p><p>Then we will require Express and set the view engine to EJS in our <em>app.js</em> file as follows:</p><pre>var express = require(&#39;express&#39;);<br>var app = express();<br>app.set(&#39;view engine&#39;, &#39;ejs&#39;);</pre><p>We’ll also include the following line so our app listens for requests:</p><pre>app.listen(3000);</pre><h3>Handling GET requests</h3><p>Congratulations, everything is ready to handle requests! There are several types of requests in HTTP, but we’ll only be handling GET requests, which are used to retrieve data from the server. To handle this kind of request in Express, we use the following method:</p><pre>app.get(&#39;/about&#39;, function(req, res) {<br>  res.render(&#39;about&#39;);<br>});</pre><p>Let’s take a look at what’s happening here. We’re telling our server that, whenever someone types in <em>somewebsite.com/about</em>, we want to fire a function. That function takes two parameters, <em>req</em> (request) and <em>res</em> (response). Using the response object, we render the <em>about page</em>.</p><p>For this to work, we’ll have to create a page named <em>about.ejs</em> in HTML. We’ll also place it in a folder called <em>views</em> inside our project folder. This is the folder where Express will look to render the view. Here you have the mega-complex about page we’ll be using for this example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SJLNngock1YatejdxUmnpQ.png" /></figure><p>Nice! But, what if the user doesn’t type in any route? Just like we do most of the times, <em>somewebsite.com</em>? Well, really easy. Change<em> /about</em> to just <em>/, </em>and render whatever page you like:</p><pre>app.get(&#39;/&#39;, function(req, res) {<br>  res.render(&#39;home&#39;);<br>});</pre><h3>Handling non-existing routes</h3><p>But what if someone types in a route that doesn’t exist? We probably don’t want a default error page to show up. Instead, we want a custom, cool error page.</p><p>Well, the good news is that it’s extremely easy to make one with Express. Just replace the route parameter in the get method with an asterisk and render your own error page like so:</p><pre>app.get(&#39;*&#39;, function(req, res) {<br>  res.render(&#39;error&#39;);<br>});</pre><h3>Trying it out!</h3><p>Finally, let’s run our server from the command line (assuming the server is named <em>app.js</em>)</p><blockquote>node app</blockquote><p>and see if it works! Let’s type in the name of our server (<em>localhost</em>, as it’s a local server running on our computer) and the port (<em>3000</em> in this case) in our browser:</p><blockquote>localhost:3000</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wO7-ggTvX9J49zDJEzKNTw.png" /><figcaption>localhost:3000 or localhost:3000/</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SJLNngock1YatejdxUmnpQ.png" /><figcaption>localhost:3000/about</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wYVyHRteNoBRCy6p4acUdQ.png" /><figcaption>localhost:3000/anythingthatwehaventsetaroutefor</figcaption></figure><p>Amazing!</p><h3>Further reading</h3><p>You can learn everything you need to know about routing in the <a href="http://expressjs.com/en/guide/routing.html">Express guide</a>, and there’s a lot of handy things in the <a href="http://ejs.co/">EJS website</a> as well!</p><p>I hope this article was helpful for you. If it was, please leave a comment and clap it up!</p><p>Happy coding… <strong><em>Or happy routing, I guess!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7cad5e3f5d5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/really-really-basic-routing-in-nodejs-with-express-d7cad5e3f5d5">Really, really basic routing in Node.js with Express</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The one thing to tell yourself when you are about to procrastinate]]></title>
            <link>https://medium.com/@paupavon/the-one-thing-to-tell-yourself-when-you-are-about-to-procrastinate-e76cc2c037dd?source=rss-33034029a855------2</link>
            <guid isPermaLink="false">https://medium.com/p/e76cc2c037dd</guid>
            <category><![CDATA[time-management]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[procrastination]]></category>
            <dc:creator><![CDATA[Pau Pavón]]></dc:creator>
            <pubDate>Tue, 13 Mar 2018 13:31:36 GMT</pubDate>
            <atom:updated>2018-03-13T13:31:36.826Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AM4eRNmgragwIAlh." /><figcaption>Photo by <a href="https://unsplash.com/@alexpresa?utm_source=medium&amp;utm_medium=referral">Alex Presa</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>1 million. That’s more or less the number of tips I’ve heard to avoid procrastination.</p><p>While the above might be a bit exaggerated, it’s true that there are tons of advices out there to help you avoid or overcome procrastination. Their workability depends on the person, but a lot of them are really useful just as a lot are useless for some people. But I think I’ve found the exception.</p><p>Regardless who you are, I’m pretty sure it’ll work for you. In fact, it’s quite simple, and the chances are you’ve already heard about it. Not sure? The next time you feel like you should be doing something but you aren’t…</p><blockquote>Just do it</blockquote><p>Yes. The Nike slogan. It is simple, really simple, yet powerful.</p><p>If you ought to do anything now… Do it! There doesn’t have to be any waiting, analyzing, thinking about it… Just jump into it.</p><p>I even encourage you to stop reading this, tell your inner self: “Just do it!”, and begin doing whatever you should be doing. Then, and if you want, come back and tell me if it did work.</p><h3>Reinforcing the technique</h3><p>Although this tip is dead simple, there are a couple of things you can do to improve it:</p><h4>Avoid thinking about it:</h4><p>The first times you put it in practice, you’ll find yourself thinking about the technique itself.</p><p><em>“I’m gonna tell myself to just do it and I’ll get it done. Yes, it’ll work. I’m sure. Last time it did, so now…”</em></p><p>By doing that, you are wasting time. Not only that, but you are also doubting on its workability as you are comparing the results it gave the previous times with the ones it may give now.</p><blockquote>Don’t overthink. Do what it says: just do it.</blockquote><h4>Think about it:</h4><blockquote>… What?</blockquote><p>I know, I just stated that not thinking about it was good for its improvement. Just as thinking is. Why?</p><p>Because you should only wrap your head around the results it has given when you aren’t going to use it. Before going to bed, while having breakfast… Just when you aren’t doing anything important (and you shouldn’t be doing anything important. If that is the case, apply the technique).</p><p>I believe this will actually reinforce your trust on it and so it’ll make it a more reliable tool for procrastination avoidance.</p><h3>Just do it!</h3><p>And that’s all for this article. I know it’s short and thus a quick read, but if I’m telling you something to boost your productiveness, why should I waste your time with more unnecessary words? I think I’ve already told you everything I could about this method.</p><p>Thank you very much for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e76cc2c037dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why you don’t need to excel at math to learn how to program]]></title>
            <link>https://medium.com/free-code-camp/why-you-dont-need-to-excel-at-math-to-learn-how-to-program-90f9697f70d9?source=rss-33034029a855------2</link>
            <guid isPermaLink="false">https://medium.com/p/90f9697f70d9</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Pau Pavón]]></dc:creator>
            <pubDate>Sat, 10 Mar 2018 17:50:11 GMT</pubDate>
            <atom:updated>2018-03-12T08:02:34.939Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a_YBHDaex8qNOUBV." /><figcaption>“Equations written in chalk on a worn-out blackboard” by <a href="https://unsplash.com/@roman_lazygeek?utm_source=medium&amp;utm_medium=referral">Roman Mager</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This is probably one of the greatest misconceptions I’ve ever heard.</p><p>If you want to program, you must be good at math. It’s totally fake. Let me explain.</p><h3>You don’t need to excel at math to learn to code</h3><p>I started coding when I was 12 years old. The math I knew was addition, subtraction, multiplication, and division. And it was <strong>more than enough</strong> to get me into the programming world. Even today, I don’t use anything more complex than powers or square roots.</p><p>If you have ever programmed any line of code, you have hopefully realized it has almost nothing to do with math. If you know how to count, you are pretty much good to go.</p><h3>The origin of the myth</h3><p>I believe I’ve figured out where this ‘myth’ comes from. You know those old (or not so old) movies about hackers and programmers. They often show computers with lots of 0s and 1s in a greenish font, flowing vertically along the screen? That’s binary code (and it doesn’t normally move around the screen, it’s just static text).</p><p>Computers understand binary code, but that’s not what programming languages are about. It may sound quite obvious, because if you are reading this you probably have some kind of relationship with this world. But you’d be amazed to see how many people think it’s all about binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_o33UJJhAFfOcRCp." /><figcaption>When I code, my screen doesn’t look like this. Maybe I’m doing something wrong. Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a>on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>But besides this misconception, I think the other factor is the relation established between the words <em>math</em> and <em>logic</em>. Programming requires logical thinking, and math also does. But golf and basketball both require a ball to be played with, and that doesn’t mean you need to know how to play basketball to take up golf.</p><h3>Making you believe what I just said</h3><p>Let’s take a proper example. Imagine you want to build a function to print out the multiplication table of a number. So, for input 2, our function will return:</p><blockquote>2 x 0 = 0</blockquote><blockquote>2 x 1 = 2</blockquote><blockquote>2 x 2= 4</blockquote><blockquote>2 x 3 = 6</blockquote><blockquote>…</blockquote><blockquote>And up to 2 x 10 = 20</blockquote><p>You will see how little math is required to do this (even though we are calculating something ‘mathematical’). For the purpose of this example, we’ll be using JavaScript.</p><p>First, we declare the <strong>function</strong>. We’ll call it <strong><em>tableOf(n)</em></strong>, where <em>n</em> is the number we want to print the table of.</p><pre>function tableOf(n) {</pre><pre>//rest of the code</pre><pre>}</pre><p>Pretty easy for the moment. Now we’ll implement something called a <strong>for loop.</strong> This is similar to a function except for the fact that, when it reaches the end, it goes back to the beginning until some condition is true</p><p>We want to print <em>n</em> times some other value (let’s call it <em>i</em>) until that value reaches 10. We have to also take into account that <em>i</em> should start from 0, as we want <em>n x 0 = 0</em> to be the first line printed. The code could be as following:</p><pre>for(i = 0; i &lt; 11; i++) {</pre><pre>console.log(n, &#39;x&#39;, i, &#39;=&#39;, n*i);</pre><pre>}</pre><p>Let’s review what we just did. We started the for loop with <em>i = 0</em>, meaning that <em>i </em>starts from 0 (as we wanted). Then we say i &lt; 11, meaning that we don’t want to exit the loop until <em>i</em> equals 11 or, in other words, we want the loop to continue if <em>i</em> is less than 11. Then we do <em>i++</em>, which means that we increase the value of <em>i</em> by 1 every time the loop starts again (so it eventually reaches 11 and exits the loop).</p><p>Then we just output <em>n</em> (the number we entered), ‘x’ (for the <em>times</em> symbol), <em>i</em>(the number for which <em>n</em> is multiplied by), ‘=’ (for the <em>equals</em> symbol), and finally <em>n*i</em> (the actual operation, <em>n times i</em>).</p><p>The previous code, combined:</p><pre>function tableOf(n) {</pre><pre>for(i = 0; i &lt; 11; i++) {</pre><pre>console.log(n, &#39;x&#39;, i, &#39;=&#39;, n*i);</pre><pre>}</pre><pre>}</pre><pre>tableOf(2);</pre><p>And it works. Is this difficult math? The only math we did was increasing <em>i</em> by one (adding), and checking if <em>i</em> was less than 11. For this concrete example, we also multiplied <em>n</em> times <em>i</em>. <strong>Wow</strong>.</p><h3>The other side of the coin</h3><p>Learning to code will make you better at math.</p><p>As I said before, programming requires logical thinking just as math does. While writing your programs, you’ll encounter a lot of problems that need to be solved. Most of the time with logic (but let’s be honest, sometimes trial and error works just fine).</p><p>Developing the skills to solve these problems is definitely going to help you with math — not only with the concepts, but with problem-solving. You can extend this to other disciplines as well, such as physics.</p><p>I hope this article serves to encourage people that want to give coding a try to do it. Trust me, I knew little about math and less about English, and I was still able to learn a lot. Knowledge has no limits.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90f9697f70d9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/why-you-dont-need-to-excel-at-math-to-learn-how-to-program-90f9697f70d9">Why you don’t need to excel at math to learn how to program</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use recursive functions to create the Fibonacci Sequence in 5 programming languages]]></title>
            <link>https://medium.com/free-code-camp/the-fibonacci-sequence-in-5-different-programming-languages-1c6514c749e5?source=rss-33034029a855------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c6514c749e5</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Pau Pavón]]></dc:creator>
            <pubDate>Wed, 28 Feb 2018 16:38:56 GMT</pubDate>
            <atom:updated>2018-03-09T07:03:06.011Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*74G0BbEUwrCaw8iQ." /><figcaption>Photo by <a href="https://unsplash.com/@charlesdeluvio?utm_source=medium&amp;utm_medium=referral">Charles Deluvio 🇵🇭🇨🇦</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The Fibonacci sequence is, by definition, the integer sequence in which every number after the first two is the sum of the two preceding numbers. To simplify:</p><p>0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …</p><p>It has many applications in mathematics and even trading (yes, you read that right: trading), but that’s not the point of this article. My goal today is to show you how you can compute any term of this series of numbers in five different programming languages using recursive functions.</p><p>Recursive functions are those functions which, basically, call themselves.</p><p>I want to note that this isn’t the best method to do it — in fact, it could be considered the most basic method for this purpose. This is because the computing power required to calculate larger terms of the series is immense. The number of times the function is called causes a stack overflow in most languages.</p><p>All the same, for the purposes of this tutorial, let’s begin.</p><p>First of all, let’s think about what the code is going to look like. It’ll include:</p><p>· A recursive function F (F for Fibonacci): to compute the value of the next term.</p><p>· Nothing else: I warned you it was quite basic.</p><p>Our function will take <em>n</em> as an input, which will refer to the <em>n</em>th term of the sequence that we want to be computed. So, F(4) should return the fourth term of the sequence.</p><p>Let’s plan it. The code should, regardless the language, look something like this:</p><pre>function F(n)</pre><pre>  if n = 0<br>    return 0</pre><pre>  if n = 1<br>    return 1</pre><pre>  else<br>    return F(n-1) + F(n-2)</pre><p>Note: the term 0 of the sequence will be considered to be 0, so the first term will be 1; the second, 1; the third, 2; and so on. You get it.</p><p>Let’s analyze the function for a moment. If it gets 0 as an input, it returns 0. If it gets 1, it returns 1. If it gets 2… Well, in that case it falls into the else statement, which will call the function again for terms 2–1 (1) and 2–2 (0). That will return 1 and 0, and the two results will be added, returning 1. Perfect.</p><p>Now you can see why recursive funcions are a problem in some cases. Imagine you wanted the 100th term of the sequence. The function would call itself for the 99th and the 98th, which would themselves call the function again for the 98th and 97th, and 97th and 96th terms…and so on. It would be <strong>really</strong> slow.</p><p>But the good news is that it actually works!</p><p>So let’s start with the different languages. I won’t give too much detail (actually, no detail at all) to make your reading experience better. There isn’t too much to detail anyways.</p><p>Let’s jump into it:</p><h3>Python</h3><pre>def F(n):</pre><pre>  if n == 0:<br>    return 0</pre><pre>  if n == 1:<br>    return 1</pre><pre>  else:<br>    return F(n-1) + F(n-2)</pre><h3>Swift</h3><pre>func F(_ n: Int) -&gt; Int {</pre><pre>  if n == 0 {</pre><pre>    return 0<br>  }</pre><pre>  if n == 1 {</pre><pre>    return 1<br>  }</pre><pre>  else {</pre><pre>    return F(n-1) + F(n-2)<br>  }</pre><pre>}</pre><h3>JavaScript</h3><pre>function F(n) {</pre><pre>  if(n == 0) {</pre><pre>    return 0;<br>  }</pre><pre>  if(n == 1) {</pre><pre>    return 1;<br>  }</pre><pre>  else {</pre><pre>    return F(n-1) + F(n-2);<br>  }</pre><pre>}</pre><h3>Java</h3><pre>public static int F(int n) {</pre><pre>  if(n == 0) {</pre><pre>    return 0;<br>  }</pre><pre>  if(n == 1) {</pre><pre>    return 1;<br>  }</pre><pre>  else {</pre><pre>    return F(n-1) + F(n-2);<br>  }</pre><pre>}</pre><h3>C++</h3><pre>int F(int n) {</pre><pre>  if(n == 0) {</pre><pre>    return 0;<br>  }</pre><pre>  if(n == 1) {</pre><pre>    return 1;<br>  }</pre><pre>  else {</pre><pre>    return F(n-1) + F(n-2);<br>  }</pre><pre>}</pre><p>And that’s it. I chose these languages just based on popularity — or at least because these 5 are the most common ones that I use They’re in no particular order. They could be classified by syntax difficulty, in my opinion, from Python (easiest) to C++ (hardest). But that depends on your personal opinion and your experience with each language.</p><p>I hope you liked this article and, if you have any questions/recommendations or just want to say hi, comment below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c6514c749e5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/the-fibonacci-sequence-in-5-different-programming-languages-1c6514c749e5">How to use recursive functions to create the Fibonacci Sequence in 5 programming languages</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>