<?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 Dom Carmel  Tremblay on Medium]]></title>
        <description><![CDATA[Stories by Dom Carmel  Tremblay on Medium]]></description>
        <link>https://medium.com/@DominicCarmel?source=rss-dc7a3ea29be------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DoXCGIuHFVDOHo7rWc_3Ww.png</url>
            <title>Stories by Dom Carmel  Tremblay on Medium</title>
            <link>https://medium.com/@DominicCarmel?source=rss-dc7a3ea29be------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 00:58:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@DominicCarmel/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[Coding Fundamentals: Conquering the Reduce Function]]></title>
            <link>https://medium.com/@DominicCarmel/coding-fundamentals-conquering-the-reduce-function-afff2428b956?source=rss-dc7a3ea29be------2</link>
            <guid isPermaLink="false">https://medium.com/p/afff2428b956</guid>
            <category><![CDATA[reduce]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[array-methods]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <dc:creator><![CDATA[Dom Carmel  Tremblay]]></dc:creator>
            <pubDate>Wed, 22 Nov 2023 17:01:41 GMT</pubDate>
            <atom:updated>2023-11-22T17:01:41.671Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M82eZc0Aw7NAY-bux9pZhA.png" /><figcaption>Image by <a href="https://stock.adobe.com/ca/contributor/305554/mushakesa?load_type=author&amp;prev_url=detail">Mushakesa </a>from Adobe Stock</figcaption></figure><p>Let’s dive into the world of the `reduce` function, and we’ll discover it’s like a Swiss Army knife for coding! It is incredibly versatile and can simplify many complex operations. For example, it can handle the transformation of multidimensional data structures into simpler ones, which can involve various operations such as flattening arrays, aggregating data, or even executing a series of asynchronous operations in a controlled sequence.</p><h3>Why Embrace the Reduce Function?</h3><p>Certainly, we can tackle the same problems using a variety of approaches other than the reduce function. Admittedly, reducemay not be intuitive at first. However, when appropriate, reduce provides several benefits. Below are key reasons to opt for reduce:</p><ul><li><strong>Declarative vs Imperative</strong>: reduce is more declarative. We describe what you want to achieve (e.g., sum all values) rather than how to do it step by step. This can lead to more readable and maintainable code.</li><li><strong>Cross-Language Utility</strong>: reduce function’s presence in multiple programming languages promotes skill portability and code consistency, enabling us to apply the same problem-solving pattern across different platforms and projects.</li><li><strong>Immutability and Side-Effects</strong>: reduce doesn’t change the original array, which helps prevent side effects in your code. This is an important aspect of functional programming, which aims to write cleaner, less error-prone code.</li><li><strong>Chainability</strong>: reduce is often used with other array methods like map and filter. These methods can be chained together to perform complex transformations in a clear and concise manner.</li><li><strong>Performance</strong>: In some cases, reduce can be faster because modern JavaScript engines can optimize methods like reduce more effectively than a user-written for loop, especially as the complexity of the operations increases.</li><li><strong>Flexibility</strong>: reduce is incredibly versatile. Beyond simple sums and products, it can be used for more complex tasks like transforming an array into an object, or even implementing your own version of map or filter.</li></ul><h3>Decoding the Reduce Function</h3><p>In JavaScript, the reduce() method applies a reducer function to each element of an array, condensing them into a single output value. The simplest way to think of this reduction is as a method that transforms a list of values into a single resultant value:</p><pre>[a1, a2, a3].reduce(f) =&gt; r</pre><p>However, let’s delve deeper by examining the mechanics of summing numbers. The mathematical formula for a reduce function that sums numbers is as follows:</p><pre>acc(n)=f(acc(n)−1​,a(n))=acc(n)−1​+a(n)</pre><p>Let’s say we have an array of numbers [a1, a2, a3], The reduce process starts with an initial value for the accumulator, often denoted as acc0. If no initial value is provided, the first element of the array (a1) is used as the initial accumulator value, and the iteration starts from the second element (a2). If we assigned the initial value 0 to acc0, then we would have:</p><pre>acc1=f(acc0,a1)=acc0+a1<br>acc2=f(acc1,a2)=acc1+a2<br>acc3=f(acc2,a3)=acc2+a3</pre><h3>Visualizing the the Mechanics of Reduce</h3><p>Let’s visualize the process of reduce. Here’s a step-by-step breakdown of its operation for a sum with an array of [1,2,3]:</p><figure><img alt="The process diagram of a reduce function" src="https://cdn-images-1.medium.com/max/391/1*IkH7tE6Tm10XDA860Y_byA.png" /></figure><p>Now that we have a better understanding of reduce, let’s code our own implementation of the reduce function in JavaScript (intentionally omitting the addition of index and array parameters for now):</p><pre>const reduce = (arr, cb, initialValue) =&gt; {<br><br>  // an empty array and no initial value provided will throw an error<br>  if (arr.length &lt; 1 &amp;&amp; initialValue === undefined) {<br>    throw new TypeError(&#39;Reduce of empty array with no initial value&#39;)<br>  }<br><br>  // We need to check if there is an initial value, otherwise use<br>  // the first element of the array as the initial value<br><br>  const startIndex = initialValue === undefined ? 1 : 0;<br>  let acc = initialValue === undefined ? arr[0] : initialValue;<br><br>  for (let i = startIndex; i &lt; arr.length; i++) {<br>    acc = cb(acc, arr[i], i, arr);<br>  }<br>  <br>  return acc;<br>}</pre><p>Let’s call our reduce function with an initial value:</p><pre>const total = reduce([1,2,3], (acc, nextElement) =&gt; acc + nextElement, 0);</pre><p>Or, without an initial value:</p><pre>const total = reduce([1,2,3], (acc, nextElement) =&gt; acc + nextElement);</pre><p>In both cases, total is equal to 6. Let’s keep in mind that we have 2 more optional parameters to our callback function: currentIndex, and arr.</p><pre>const total = reduce([1,2,3], (acc, nextElement, currentIndex, arr) =&gt; acc + item, 0);</pre><p>The currentIndex represents the position of nextElement within the array. On the first call, its value is 0 if initialValue is provided; otherwise, it&#39;s 1. arr is the array upon which reduce() was invoked. While we don&#39;t use these two optional parameters for a sum, they can be useful in other scenarios.</p><p>True, the reduce function is incredibly versatile, and we should explore beyond simple summation. Consider the data from the <a href="https://openweathermap.org/api">OpenWeatherMap API</a>: when users are planning outdoor activities, reduce can be used to aggregate forecast data to identify the optimal day for such activities. It can calculate average temperature, humidity, and wind speed, and keeping a list of the days for the intended period. Here’s the sample data from the API:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9adc2b2a52bc6b8e909a804c8e5d5973/href">https://medium.com/media/9adc2b2a52bc6b8e909a804c8e5d5973/href</a></iframe><p>The API returns an array packed with data, much of which is superfluous for our needs. We aim to streamline this into a more user-friendly object. Using the reduce function, we&#39;ll build an object containing the following properties:</p><ul><li>temp_avg, feels_like_avg, humidity_avg, wind_speed_avg to keep the average of the temperature, feels like, humidity, and wind speed.</li><li>day_details to keep the relevant data on each day</li></ul><p>Here’s an example of what the output might look like:</p><pre>{<br>  temp_avg: 299.04,<br>  feels_like_avg: 299.12,<br>  humidity_avg: 60.75,<br>  wind_speed_avg: 4.04,<br>  day_details: {<br>    1684951200: {<br>      dt: 1684951200,<br>      summary: &#39;Expect a day of partly cloudy with rain&#39;,<br>      conditions: &#39;light rain&#39;,<br>      temp: 299.03,<br>      feels_like: 299.21,<br>      humidity: 59,<br>      wind_speed: 3.98,<br>    },<br>    ...<br>  },<br>}</pre><p>Let’s start by outlining our reduce function template:</p><ul><li>acc will hold the final object that we’re creating.</li><li>day refers to the current day’s object from which we’re extracting information.</li><li>currIndex is the index of the current day within the array. This won&#39;t be necessary for our function.</li><li>arr represents the original array. We’ll use the length of arr to calculate averages.</li><li>The initial value must be an empty object.</li></ul><pre>const weatherConditions = data.daily.reduce((acc, day, currIndex, arr) =&gt; {<br><br>// implement the code here<br><br>}, {});</pre><p>Let’s see what is required to calculate the average of the temperatures:</p><pre>// 1. creating a new &#39;temp_avg&#39; property in our acc object if it does not exist<br>// 2. Adding the temperature of the current day element<br>// 3. dividing it by the length of the array to produce the average<br>// 4. Rounding up the average to 2 decimals<br><br>acc[&#39;temp_avg&#39;] =<br>    (acc[&#39;temp_avg&#39;] || 0) +<br>    Math.round((day.temp.day / arr.length) * 100) / 100;</pre><p>We’ll repeat the same process for all averages:</p><pre>  // Calculating the averages<br>  acc[&#39;temp_avg&#39;] =<br>    (acc[&#39;temp_avg&#39;] || 0) +<br>    Math.round((day.temp.day / arr.length) * 100) / 100;<br><br>  acc[&#39;feels_like_avg&#39;] =<br>    (acc[&#39;feels_like_avg&#39;] || 0) +<br>    Math.round((day.feels_like.day / arr.length) * 100) / 100;<br><br>  acc[&#39;humidity_avg&#39;] =<br>    (acc[&#39;humidity_avg&#39;] || 0) +<br>    Math.round((day.humidity / arr.length) * 100) / 100;<br><br>  acc[&#39;wind_speed_avg&#39;] =<br>    (acc[&#39;wind_speed_avg&#39;] || 0) +<br>    Math.round((day.wind_speed / arr.length) * 100) / 100;</pre><p>Additionally, we want to retain pertinent details for each day as objects. First, we need to initialize the day_details property in the acc object as an empty object if it doesn&#39;t already exist.</p><pre>  acc[&#39;day_details&#39;] = acc[&#39;day_details&#39;] || {};</pre><p>Subsequently, we want to add the data for the day. The value associated with the day_details key will also be an object, with keys representing the timestamp of each day (day.dt).</p><pre>  acc[&#39;day_details&#39;][day.dt] = {<br>    dt: day.dt,<br>    summary: day.summary,<br>    conditions: day.weather[0].description,<br>    temp: day.temp.day,<br>    feels_like: day.feels_like.day,<br>    humidity: day.humidity,<br>    wind_speed: day.wind_speed,<br>  };</pre><p>Here’s what our final reduce function will look like:</p><pre>const weatherConditions = data.daily.reduce((acc, day, currIndex, arr) =&gt; {<br>  // Calculating the averages<br>  acc[&#39;temp_avg&#39;] =<br>    (acc[&#39;temp_avg&#39;] || 0) +<br>    Math.round((day.temp.day / arr.length) * 100) / 100;<br><br>  acc[&#39;feels_like_avg&#39;] =<br>    (acc[&#39;feels_like_avg&#39;] || 0) +<br>    Math.round((day.feels_like.day / arr.length) * 100) / 100;<br><br>  acc[&#39;humidity_avg&#39;] =<br>    (acc[&#39;humidity_avg&#39;] || 0) +<br>    Math.round((day.humidity / arr.length) * 100) / 100;<br><br>  acc[&#39;wind_speed_avg&#39;] =<br>    (acc[&#39;wind_speed_avg&#39;] || 0) +<br>    Math.round((day.wind_speed / arr.length) * 100) / 100;<br><br>  // Keeping the relevant info on each day<br>  acc[&#39;day_details&#39;] = acc[&#39;day_details&#39;] || {};<br>  acc[&#39;day_details&#39;][day.dt] = {<br>    dt: day.dt,<br>    summary: day.summary,<br>    conditions: day.weather[0].description,<br>    temp: day.temp.day,<br>    feels_like: day.feels_like.day,<br>    humidity: day.humidity,<br>    wind_speed: day.wind_speed,<br>  };<br><br>  return acc;<br>}, {});</pre><p>Our exploration of the reduce function was more about comprehension than optimization. As we’ve seen, using reduce to restructure API data can be incredibly effective. There’s a multitude of scenarios where reduce can be applied, and its utility is amplified when combined with other array methods like map and filter. I encourage you to master its application across various scenarios. Indeed, reduce is like a Swiss Army knife in the world of coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afff2428b956" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Developers, Why Python is Your Next Big Move]]></title>
            <link>https://medium.com/@DominicCarmel/javascript-developers-why-python-is-your-next-big-move-4120342e49ba?source=rss-dc7a3ea29be------2</link>
            <guid isPermaLink="false">https://medium.com/p/4120342e49ba</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[python-web-developer]]></category>
            <category><![CDATA[tech-career-trends]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Dom Carmel  Tremblay]]></dc:creator>
            <pubDate>Wed, 15 Nov 2023 14:57:16 GMT</pubDate>
            <atom:updated>2023-11-15T14:57:16.141Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Future-proof your career with Python" src="https://cdn-images-1.medium.com/max/1024/1*RSV6LawjZFAr0J2QyM4QPQ.png" /></figure><p>Given the ever-changing nature of the tech industry, JavaScript developers can greatly benefit from learning Python to enhance their versatility and job security. Python’s prominence in AI and machine learning, as well as its applications in backend development and data analytics, makes it a strategic skill to acquire. The ability to transition between web development with JavaScript and data-intensive or AI-driven projects with Python can increase developers’ marketability and adaptability to industry fluctuations.</p><h3>Learn a New Web Development Framework</h3><p>If you’re looking to level up your web development game and dive into Python at the same time, getting into Django could be a smart play. It’s like hitting two targets with one shot. Django is a solid framework that’s built on Python, so you get to sharpen your dev skills while you’re picking up Python. Plus, Django has this ‘batteries-included’ vibe, which means it comes packed with all the tools you need for web projects.</p><h3>Web Development is Becoming More Interdisciplinary</h3><p>It’s no secret to anyone — AI is becoming a huge deal. It’s transforming the game by making apps smarter and more intuitive. Now, Python can play a crucial role in AI projects. It boasts a killer lineup of AI libraries, which, trust me, you’ll love once you delve into things like machine learning. So, while you’re doing great with JavaScript, adding Python to your skill set might set you apart when you’re building AI-powered features. Keep Python in your back pocket, and you’ll be ready to tackle some seriously cool projects.</p><h3>Python Opens the Door to Expand Your Skillset</h3><p>You’re doing well with JavaScript, but let’s talk about expanding your skill set. Python is where you can truly diversify. It’s the key to unlocking a realm of data analytics and machine learning capabilities. With Python, you can analyze large data sets, create predictive models, and even implement AI algorithms that can be integrated into your web applications. It’s an investment in your future as a versatile developer. Read this interesting Medium article if you want to learn more about Python/Django.</p><h3>Learning Python Will Make You a Better Developer</h3><p>Stepping into Python will hone your development skills in several ways. Firstly, Python’s robust support for classical Object-Oriented Programming (OOP) will deepen your understanding of concepts like inheritance and polymorphism, which can enhance your approach to structuring JavaScript applications. Furthermore, by learning Python, you’ll gain the ability to critically compare the strengths and weaknesses of different programming languages, preparing you to pick up new languages with ease as needed. Lastly, Python will offer you a fresh perspective, breaking you out of the JavaScript mindset and equipping you with alternative strategies for problem-solving, which is invaluable in tackling various coding challenges.</p><p>To conclude, learning Python is not just about skill acquisition; it’s about future-proofing your career. By embracing Python, JavaScript developers can elevate their coding skills, adapt to the evolving demands of the tech industry, and position themselves at the forefront of innovation. Python’s versatility in web development, data analytics, and AI, combined with its solid foundation in OOP, makes it an essential language for any developer looking to stay competitive and versatile in a rapidly changing technological landscape. This journey into Python will refine your programming skills, broaden your problem-solving toolkit, and ensure that you are ready for the next wave of digital transformation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4120342e49ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unleashing Developer Superpowers: Inside OpenAI’s Latest Game-Changer]]></title>
            <link>https://medium.com/@DominicCarmel/unleashing-developer-superpowers-inside-openais-latest-game-changer-2f850256ba88?source=rss-dc7a3ea29be------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f850256ba88</guid>
            <category><![CDATA[innovation]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[technology-news]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Dom Carmel  Tremblay]]></dc:creator>
            <pubDate>Fri, 10 Nov 2023 21:38:24 GMT</pubDate>
            <atom:updated>2023-11-10T21:38:24.974Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Futuristic coder’s workspace with a 3D holographic code display and a virtual assistant interface, symbolizing the advanced AI-driven development environment." src="https://cdn-images-1.medium.com/max/1024/1*lZtaVaotI0MTkneIdcCaCg.png" /></figure><p>What is really appealing to me as a developer is not only solving problems with code but also being part of the future. We’re always looking forward to new technologies and assessing how they can benefit us. We’ve witnessed several tech waves over the years, but generative AI is a veritable tsunami!</p><p>ChatGPT is revolutionizing the way we build, interact, and innovate. ChatGPT notably enhances our productivity by writing boilerplate code, generating code snippets, and automating coding tasks. With this powerful assistant, we have become faster problem-solvers, capable of explaining complex code and brainstorming solutions to challenging problems. At times, ChatGPT even serves as a mentor, aiding in learning and skill enhancement.</p><p>In essence, ChatGPT endows us with superpowers to build the future even more swiftly! Following the latest feature unveilings from OpenAI, announced at their inaugural developer conference on November 3, our capabilities have now been significantly augmented! Let’s delve into these new features, equipped with the power to redefine our role in a tech AI-driven world.</p><h3>Turbo-Charged Chat GPT</h3><p>Chat GPT Turbo, a souped-up version of the already formidable GPT-4, introduces several thrilling new features and enhancements to pique our interest. Key highlights include:</p><ul><li><strong>Increased Context Window:</strong> With a 128k (128,000 tokens) context window, which Sam Altman, CEO of OpenAI, equates to the breadth of 300 books, the model can retain and process far more information throughout conversations. This proves indispensable for applications necessitating extensive context management.</li><li><strong>Updated Knowledge Cutoff</strong>: No longer confined to September 2021, the new knowledge cutoff is April 2023, enabling ChatGPT to provide responses with up-to-the-minute context. When soliciting newer information, ChatGPT ingeniously utilizes Bing to enhance its responses.</li><li><strong>More Affordable for Developers:</strong> The revised pricing model renders development more cost-effective, democratizing access to state-of-the-art AI and allowing a wider spectrum of creators to innovate with GPT.</li><li><strong>Text-to-Speech Integration: </strong>The synergy of visual input processing and text-to-speech technology forges a more comprehensive and interactive user experience, setting the stage for the development of immersive applications.</li></ul><h3>Leveraging Assistants</h3><p>The Assistants API is a development I find particularly exhilarating. It enables the creation of applications that can undertake tasks akin to a human assistant. Capabilities we can harness include:</p><ul><li><strong>Enriched Chatbot Interactions</strong>: Providing enhanced customer service or personal coaching experiences.</li><li><strong>Streamlined Workflow Efficiencies</strong>: Automating routine tasks such as scheduling, sending reminders, or filtering emails.</li><li><strong>Developer Assistance</strong>: Generating programming code snippets, elucidating code functionalities, or drafting documentation based on natural language instructions.</li></ul><h3><strong>Monetizing with Custom GPTs</strong></h3><p>OpenAI’s novel GPT platform empowers developers — or indeed anyone — to craft custom Chat GPT agents without any coding prerequisites, thereby making AI development more approachable and bespoke.</p><ul><li>It simplifies the management of prompts and instruction sets, expedites the deployment of specialized agents, and ensures user interactions are both helpful and succinct.</li><li>The platform unveils new potential revenue streams for developers, as OpenAI has announced a revenue share model predicated on the usage of custom GPTs.</li></ul><p>I’m intrigued to see the variety of custom ChatGPT applications we can build!</p><h3>The Future Is Here</h3><p>Are you prepared to be a developer of the future, equipped with superpowers? The latest tools from OpenAI represent a giant leap toward more dynamic, interactive, and intelligent applications that can foster innovation and user engagement. As we embrace these advancements, I invite you to share your experiences and insights. How will these tools shape your projects? What innovative applications can we dream up together?</p><p>Let’s continue the conversation and grow as a community. The only question that remains is, can we keep pace with these advancements? With the collaborative spirit of our developer community and our trusted Chat GPT to assist us, we’re more than ready for the challenge ahead!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f850256ba88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 5 Reasons To Learn JavaScript in 2023]]></title>
            <link>https://medium.com/@DominicCarmel/top-5-reasons-to-learn-javascript-in-2023-fe600cd5b2cf?source=rss-dc7a3ea29be------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe600cd5b2cf</guid>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[stackoverflow-survey]]></category>
            <category><![CDATA[2023-trends]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Dom Carmel  Tremblay]]></dc:creator>
            <pubDate>Mon, 02 Jan 2023 22:50:01 GMT</pubDate>
            <atom:updated>2023-01-12T21:45:55.791Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*chEw9LkqsePJDAtTVxs8Kw.png" /></figure><p>Last year, we revealed the <a href="https://medium.com/@DominicCarmel/top-5-reasons-to-learn-javascript-in-2022-e725a62886eb">Top 5 Reasons To Learn JavaScript in 2022</a>. All of these are still applicable in 2023, but we need to look more than just JavaScript alone because it serves as the base for many other languages and frameworks. To learn any of these frameworks, we need to learn JavaScript in the first place. The top 5 reasons to learn JavaScript inside the framework of the JavaScript ecosystem are listed below.</p><h3>1. JavaScript is now the most commonly used programming language for ten years in a row</h3><p>No surprise here, same as last year. According to the <a href="https://survey.stackoverflow.co/2022/">2022 Stack Overflow Developer Survey</a>, 2022 marks JavaScript’s tenth year in a row as the most commonly used programming language.Nearly 70% of developers continue to use JavaScript. However, Python is the most user-friendly language for beginners and is practically neck and neck with JavaScript among those beginning to code (58% vs. 60%). While Python and JavaScript are both very versatile, JavaScript is probably the top choice for Web development and Python for data science and machine learning (which are now in high demand).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*dcb5BdnP0RtaZlvlUBZHUA.png" /><figcaption>Top languages used by professional developers in the <a href="https://survey.stackoverflow.co/2022/">2022 Stack Overflow Developer Survey</a></figcaption></figure><h3>2. TypeScript show impressive gains</h3><p>In the 2022 Stack Overflow Developer Survey, TypeScript is being used by 40% of professional developers and it’s the fourth most loved language more so than JavaScript (73% vs 61%). In addition, according to the <a href="https://www.hackerrank.com/research/developer-skills/2023#:~:text=Developers%20are%20nearly%207%20percentage,to%20a%20recovery%20in%202023.">2023 HackerRank Developer Skills Report</a>, TypeScript grew on its platform by more than 300% year over year!</p><p>TypeScript is not exactly JavaScript per say, but it does build on top of it. You still need to learn JavaScript because TypeScript provides all the features and functionalities of JavaScript with some added features.</p><p>JavaScript is a weakly typed language, which means that you can declare variables that can hold any value without stating their type. This is one of the primary differences. Based on the value of the variable, JavaScript will determine its type. For instance, ‘hello’ can be assigned to a variable to convert it to a string type. Since the variable can easily be set to a different type without any issues, this enhanced flexibility could also result in errors. If we use let to declare the variable in this instance, our ‘hello’ variable can unexpectedly turn into an array like [1,2,3].</p><p>TypeScript allows specifying the types of variables and reports errors when the types don’t match. In addition, with Vanilla JavaScript looking at function parameters, developers don’t have any clue about the data that needs to be passed in without looking at the documentation or the function implementation. With TypeScript, you can add that information right in the code editor and find mistakes as they happen. Development stacks are integrating TypeScript more commonly.</p><h3>3. Popular Front-End Technologies Based on JavaScript</h3><p>According to the <a href="https://survey.stackoverflow.co/2022/">2022 Stack Overflow Developer Survey</a>, React.js and JQuery are the two most common front-end web technologies used by professional developers and those learning to code with 43% and 29% respectively. Moreover, according to the <a href="https://www.hackerrank.com/research/developer-skills/2023#:~:text=Developers%20are%20nearly%207%20percentage,to%20a%20recovery%20in%202023.">2023 HackerRank Developer Skills Report</a>, React is the 4th in-demand skill with more than 100% growth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*brFAXBDl0Lq1NHKpBtbXZg.png" /><figcaption><a href="https://survey.stackoverflow.co/2022/#web-frameworks-and-technologies">Web frameworks and technologies</a></figcaption></figure><p>React is a JavaScript library for building highly responsive user interfaces. React’s classification as a framework or a library is up for debate. Because it is neither a full-fledged framework like Next JS nor a simple library, in my opinion, it occupies a middle ground. In fact, React’s declarative components and unidirectional data flow do enforce some coding best practises. With a pure library like jQuery, we have complete control over how the code is implemented.</p><p>The finality is React is the most popular front-end library at the moment. While other frameworks such as Angular do implement their specific directives, React does not reinvent the wheel. It is simply based on JavaScript. Learning JavaScript as a foundation to be proficient in React makes total sense.</p><h3>4. Popular Back-End Technologies Based on JavaScript</h3><p>Looking back at the ranking of Web technologies from the Stack Overflow Developer Survey above, we can see that Node.js and Express are the two most popular back-end technologies, with 47% and 23% use, respectively. The JavaScript engine used by Node.js, which is the same one used by our browser, may run on any computer. We can create robust networking applications using JavaScript, such as web servers, with Node.js. A simple framework that enables us to create web servers on top of Node.js is Express.</p><h3>5. The Rise of the Full-Stack Developer</h3><p>The front end and the back end can both be created by a full-stack developer. Because of their versatility in expertise, full-stack developers are in hugh-demand across the tech industry. In the<a href="https://hired.com/2022-state-of-software-engineers/"> 2022 State of Software Engineers</a>, full-stack engineer was the most in-demand software engineer role on the Hired platform.</p><p><a href="https://hired.com/2022-state-of-software-engineers/">2022 State of Software Engineers | Report Uses Platform Data + Survey</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*SwQVJYCttXLwJCTbYzi6NQ.png" /><figcaption>Most in demand software engineer roles on the Hired platform</figcaption></figure><p>Although HTML, CSS, and JavaScript are well-known front-end technologies, there are a variety of back-end options as well, including Python,.net, PHP, and more. Learning a new back-end framework in a different language, however, comes with an additional learning curve. On the other hand, we are able to use JavaScript at both ends of the stack with Node.js.</p><p>In conclusion, if we take a serious approach to a job in Web development in 2023, understanding JavaScript is probably unavoidable. If we’re studying programming more casually or are more interested in data analytics or machine learning, Python is a strong contender. How do you feel? Do you have any further arguments for learning JavaScript that we should think about in 2023?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe600cd5b2cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 5 Reasons To Learn JavaScript in 2022]]></title>
            <link>https://medium.com/@DominicCarmel/top-5-reasons-to-learn-javascript-in-2022-e725a62886eb?source=rss-dc7a3ea29be------2</link>
            <guid isPermaLink="false">https://medium.com/p/e725a62886eb</guid>
            <category><![CDATA[trends-2022]]></category>
            <category><![CDATA[codingbootcamp]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Dom Carmel  Tremblay]]></dc:creator>
            <pubDate>Sun, 16 Jan 2022 18:42:36 GMT</pubDate>
            <atom:updated>2022-01-16T18:42:36.153Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kci3fAxsO-1c9zmkB1tZJw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/xkBaqlcqeb4?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditShareLink">Lautaro Andreani</a> on <a href="https://unsplash.com/s/photos/javascript?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>1. JavaScript Has Been The Most Commonly Used Language For Nine Years In a Row</h3><p>JavaScript continues to be one of the most popular languages used by developers. According to the <a href="https://insights.stackoverflow.com/survey/">2021 Stack Overflow Survey</a>, JavaScript has maintained its stronghold as the most commonly used programming language for the ninth year in a row. Looking more closely at the numbers, JavaScript is being utilized by almost 70% of developers leading Python (44%) and Java (34%). In addition to that, TypeScript — a strongly-typed implementation of JavaScript — is used by 36% of developers. Finally, NodeJS, the JavaScript network application that allows building Web servers among other things sits in 6th position, right in front of Java.</p><h3>2. The Development Environment Is Easy to Setup</h3><p>You don’t need a complicated setup to develop with JavaScript. You can use JavaScript right in your browser! Simply open the developer tools in the Chrome browser for example (CTRL+Shift+i) and you can start typing JavaScript code immediately! A typical developer setup is using <a href="https://nodejs.org/en/">NodeJS </a>and a code editor like <a href="https://code.visualstudio.com/">Visual Studio Code</a>, both are pretty straightforward to set up.</p><h3>3. JavaScript Is The Most Versatile Language Out There</h3><p>Developing powerful Web apps is the most popular use of JavaScript. You can develop a highly responsive front-end with React JS for example, the most popular front-end framework for building modern user interfaces. Similarly, you can develop a high-performance back-end with Node JS and Express JS pretty fast! JavaScript shines in other areas too. If you’re developing for the blockchain, the front-end will more than likely be built with React JS. Apps on the Ethereum network are developed using Solidity, a language that is syntactically very similar to JavaScript. Unit testing is of utmost importance when creating blockchain apps. Mocha/Chai is the typical testing framework also used by JavaScript developers. With Node JS, you can develop any type of network application like Web servers, but also chat or gaming applications. Your JavaScript skills can be reused for almost any platform out there using one of many JavaScript frameworks available: React Native for mobile, Electron for desktop, and TensorFlow for machine learning.</p><h3>4. The JavaScript Language Is Being Improved Every Year</h3><p>JavaScript has come a long way since its early days as a scripting language for the Netscape browser! In fact, the language has evolved tremendously, especially since the ECMAScript 2015 specification, commonly referred to as ES6. Each year, ECMA (the standards organization for JS) is adding new features to the JavaScript specification that improve the language. Since then, ES7, ES8, ES9, ES10, ES11, ES12 have been released! Contrary to popular belief that JavaScript is slow because it’s an interpreted language, it’s actually very fast thanks to its just-in-time compiler!</p><h3>5. JavaScript Can Boost Your Career</h3><p>JavaScript is a top skill in demand by employers. According to the <a href="https://info.hackerrank.com/rs/487-WAY-049/images/HackerRank-2020-Developer-Skills-Report.pdf">2020 HackerRank Developer Skills Report</a>, over 50% of hiring managers are looking for JavaScript skills. Yet, JavaScript isn’t taught in standard computer science curriculums at universities. Learners have a better chance of learning JavaScript through a coding bootcamp or by watching online tutorials. The HackerRank report raise the fact that 1 in 3 hiring managers have already hired a bootcamp grad. Learning JavaScript commands a high salary. The average salary of a JavaScript developer is $111,069 per year (Indeed) in the U.S. and $82,786 per year in Canada (Indeed).</p><p>If you’ve been wondering what language to learn in 2022, JavaScript should be your top choice. It’s everywhere because it’s so versatile and it’s much in demand. It’s the best foundation to start a developer career.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e725a62886eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding JavaScript’s Weird Decimal Calculations]]></title>
            <link>https://medium.com/@DominicCarmel/understanding-javascripts-weird-decimal-calculations-e65f0e1adefb?source=rss-dc7a3ea29be------2</link>
            <guid isPermaLink="false">https://medium.com/p/e65f0e1adefb</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[binary]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Dom Carmel  Tremblay]]></dc:creator>
            <pubDate>Mon, 08 Apr 2019 17:01:01 GMT</pubDate>
            <atom:updated>2020-07-25T04:18:41.208Z</atom:updated>
            <content:encoded><![CDATA[<p>As developers (or future developers), we need to be aware of the way JavaScript handles numbers. JavaScript does have its fair share of quirks and oddities and number manipulation does not seem to be any different. The classic example that everyone keeps referring too is the following calculation:</p><pre>0.1 + 0.2 === 0.3 // this is false!</pre><pre>because</pre><pre>0.1 + 0.2 = 0.30000000000000004</pre><p><strong><em>What?</em></strong> Is this another quirk of JavaScript? Actually, it isn’t. We get the same weird result in any language using <em>double-precision floating numbers</em>. To understand why we need to embark on an exciting journey to learn computer calculation!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*56Otu4UATsfkKvjh" /><figcaption>Photo by <a href="https://unsplash.com/@docrowdee?utm_source=medium&amp;utm_medium=referral">Ruediger Theiselmann</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>How computers represent data internally</h3><p>Computers are using the <strong>binary system</strong> to represent numbers. This system uses only <em>2 digits called bits</em> to represent numbers: 0 and 1. The binary system is well suited for computers for 2 main reasons:</p><ol><li>0 and 1 are states that can easily be represented with electrical current. The absence of voltage means 0 and a presence of voltage means 1.</li><li>Using more than 2 states could lead to errors because the voltage amplitude would be less drastic between states. Consequently, any variations in the voltage could have a significant impact and corrupt the data.</li></ol><p>Before getting into the details of the binary system, let’s review the decimal system that we learned since we were kids. It will allow us to better understand how binary works.</p><h3><strong>The decimal number system</strong></h3><p>The decimal system is a positional system using a base of 10 and 10 digits (0,1,2,3,4,5,6,7,8,9) where the value of each digit depends on its position. For example, these are the place values of each digit in the number 4567. Starting from the right, each position is increasing by a power of 10.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*8BrT3vUx3wdRSk3IevpIUA.png" /></figure><p>To have the final value, we calculate the following:</p><pre><strong>(4 x 1000) + (5 x 100) + (6 x 10) + (7 x 1) = 4567</strong></pre><h3>The binary number system</h3><p>Like the decimal system, binary is also a positional system, but with a base 2 and only 2 binary digits or <em>bits</em>(0, 1). Again each value depends on its position. Let’s represent 75 in binary. Starting from the right, each position is increased by a power of 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*ZYmXqcDmHHE55NuOwV-jDQ.png" /><figcaption>75 in binary</figcaption></figure><pre><strong>(0 x 128) + (1 x 64) + (0 x 32) + (0 x 16) + (1 X 8) + (0 x 4) <br>+ (1 x 2) + (1 x 1) = 75</strong></pre><p>Taken for granted that we use a full eight bits for a positive number, the maximum value we can represent is 255.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*5Ja_0bC_o4VEupRvt0cETw.png" /><figcaption>255 in binary</figcaption></figure><pre><strong>1 x 128) + (1 x 64) + (1 x 32) + (1 x 16) + (1 x 8) + (1 x 4) <br>+ (1 x 2) + (1 x 1) = 255</strong></pre><p>The minimum being 0, we can represent 256 different values using 8 bits. However, the maximum and minimum values do change if we consider negative numbers.</p><h3>The binary representation of negative numbers</h3><p>The left-most bit is used by computers to identify a negative number. If it’s 1, it’s a negative number and if it’s 0, it’s a positive number. For example, to represent -75, the binary representation is the following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*maH4AJWJGv8oD3Idhd9cyA.png" /><figcaption>-75 in binary</figcaption></figure><p>Because it’s a negative number, the left-most bit needs to be 1 and its value is -128. We must then add values to get to -75.</p><pre><strong>(1 x -128) + (0 x 64) + (1 x 32) + (1 X 16) + (0 x 8) + (1 x 4) <br>+ (1 x 1) = -75</strong></pre><p>In that case, the maximum positive value that can be represented is 127 and the minimum value is -128. We have still 256 possible different values, but the range is different. We’ve seen how to represent positive and negative values. What about fractional values? Let’s see how it goes with fractions.</p><h3>Representing fractions in binary</h3><p>Before getting into a floating-point representation, let’s examine how fractions can be stored in 16 bits. The first 6 bits form the fractional part and the next 10 bits the whole number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-0iyjLEOwzOnumrZFJhIZg.png" /></figure><p>As we can see, the values for the fractional part are halved with each position. We can calculate the decimal value of the whole number with the following:</p><pre><strong>(0 x -512) + (0 x 256) + (1 x 128) + (1 x 64) + (1 x 32) + (1 x 16) + (1 x 8) + (1 x4) = 252</strong></pre><p>And the decimal value of the fractional part is the following:</p><pre><strong>(1 x 0.5) + (0 x 0.25) + (1 x 0.125) + (1 x 0.0625) + (0 x 0.03125) + (0 x 0.0156) = 0.6875</strong></pre><p>Adding the two parts together:</p><pre><strong>252 + 0.6875 = 252.6875</strong></pre><p>Having a fixed fractional part is convenient to understand how it works, but computers are using a floating-point representation.</p><h3>Floating-point representation in binary</h3><p>To understand floating-point representation in binary, we need to take a moment and have a look at the scientific notation where any number can be expressed with a <strong><em>significant</em></strong> (sometimes referred as the mantissa) and an <strong><em>exponent</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*cMsF42kKyOrA6lglLybDfw.png" /></figure><p><strong>Some examples of numbers using the scientific notation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*RVLDbnXpajOvgEvl-8DMeQ.png" /></figure><p>Computers do follow this notation to represent real numbers in the binary system. Let’s use 16 bits to represent a floating-point number. Starting from the right, the first 6 bits are used to represent the exponent and the following 10 bits represent the significant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_L0CiyoFkmrybz6Ysmbcrg.png" /></figure><p>The left-most bit of both the significant and exponent is a signed bit. 1 for the significant means that it’s a negative number and 1 for the exponent means it’s a negative exponent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oy8NKZtP7X_t0cKi5OjC2Q.png" /></figure><p>To have the full picture, we need to place an imaginary binary point at the following location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wLKN4oI2l2sCdvvSsxTX4A.png" /></figure><p>Let’s find out the equivalent decimal value. First, we need to calculate the exponent. We know the exponent is positive since its signed bit contains 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jFn9_jfWpI1ukrhOtVu34Q.png" /></figure><p>We can obtain the value of the exponent with the following:</p><pre>(0 x -32) + (0 x 16) + (0 x 8) + (0 x 4) + (1 x 2) + (1 x 1) = 3</pre><p>We then get the following expression:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*PVeOzm9BbGdsCkFF80KHgA.png" /></figure><p>To transform it into decimal notation, the binary point needs to be moved by 3 (exponent value) positions to the right. Then we can obtain the value with the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*vXUfRuIaUJHkX0x4qfF6zg.png" /></figure><p>We can obtain the final decimal value with the following calculation:</p><pre>(0 x -8) + (1 x 4) + (0 x 2) + (0 x 1) + (1 x 0.5) + (0 x 0.25) + (1 x 0.125) + (1 x 0.0625) + (1 x 0.03125) + (1 x 0.0156) = <strong>4.7343</strong></pre><p>Now that we understand better how floating-point numbers are being represented in binary, let’s explore how JavaScript handles numbers.</p><h3>Binary representation in JavaScript</h3><p>The representation of numbers in JavaScript follows the format according to the <a href="https://en.wikipedia.org/wiki/IEEE_754">IEEE-754</a> standard. Every number (of type Number) in JavaScript is stored as a double-precision floating-point number with 64 bits. 1 bit is used for the sign, 11 bits for the exponent, and 52 bits for the significand. Note that the positions of the exponent and the significand are inverted, but the principle remains the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XulmPsdzGagxz9aj8h_1NA.png" /></figure><h3>Rounding errors resulting from floating-point numbers</h3><p>The problem with floating-point numbers comes from the fact that not all numbers can be represented accurately with a computer. First, let’s take an example in decimals. If we divide 1/3, the decimals are repeating infinitely.</p><pre>0.33333333333333333333333333...</pre><p>This comes from the fact that the denominator (3) has not a prime that’s occurring in the base (10). In other words, fractions such as 1/3, 2/3, 1/7, 5/6 will have digits that repeat periodically. The same situation occurs with binary.</p><p>In binary, only numbers where the denominator is a power of 2 can be represented finitely. For example, 1/10 in binary will have periodic digits.</p><pre>0.00011001100110011001100110011...</pre><p>The following is the scientific notation of the binary number above:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/0*SBbKO5TG6Sc31p-V" /></figure><p>This is the binary number we obtain with 64 bits (I am not going into the details of the conversion calculation here. To know more about it, you can read this <a href="https://blog.angularindepth.com/javascripts-number-type-8d59199db1b6">excellent article</a> from <em>Max Koretskyi</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*05ivgjti_3zCTqbE" /></figure><p>Since we have a limited amount of bits (52) to represent a number with an unlimited fraction, we need to round the number. In JavaScript, the binary number above will be rounded to obtain the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hWDJclLY5C5cVrdT" /></figure><p>Now because the number needs to be rounded, we are losing some precision even with 52 bits. The resulting binary number is, in fact, an <em>approximation</em> of the actual value.</p><p>We repeat the process for the representation of 0.2 and the binary is also rounded. Then the two values are added together and the sum is also rounded. In the end, the result of the operation in decimal becomes:</p><pre><strong>0.3000000000000000444089209850062616169452667236328125</strong></pre><p>But we see only:</p><pre><strong>0.30000000000000004</strong></pre><h3>That was quite a journey</h3><p>Quite a journey indeed. To better understand rounding errors produced by floating-point arithmetic, we learned along the way how computers store numbers in binary and how to represent positive and negative values, and finally how to represent floating-point values in JavaScript. We learned that some numbers cannot be accurately represented by computers and binary numbers with periodic digits need to be rounded. That is what is causing the weird result when executing 0.1 + 0.2.</p><p>Question is how can we avoid rounding errors with the arithmetic of floating-point values? One solution is to work with integers whenever possible. For example, when using currency values and performing the following operation, we get:</p><pre>10.10 + 10.20 = 20.299999999999997</pre><p>Working in cents instead, thus integer values, we obtain:</p><pre>1010 + 1020 = 2030 / 100 = 20.3 </pre><p>Another approach and probably a better one is to use a math library such as <a href="https://mathjs.org/">math.js</a>. I hope this clarifies how computers and more specifically JavaScript handle number representation in binary. If you wish to continue your journey to learn more, make sure to visit the following references:</p><ul><li><a href="https://youtu.be/TbvYNdoRWQo?list=PLTd6ceoshprcpen2Jvs_JiuvWvqIAkzea">The binary number system</a>, <br><em>Computer Science</em> (video series).</li><li><a href="https://blog.angularindepth.com/javascripts-number-type-8d59199db1b6">Here is what you need to know about JavaScript’s Number type</a>, <em>Max Koretskyi.</em></li><li><a href="http://2ality.com/2012/04/number-encoding.html">How numbers are encoded in JavaScript</a>, <em>2ality.</em></li><li><a href="https://modernweb.com/what-every-javascript-developer-should-know-about-floating-points/">What Every JavaScript Developer Should Know About Floating Points</a>, <em>Brian Rinaldi.</em></li><li><a href="https://www.electronics-tutorials.ws/binary/binary-fractions.html">Binary Fractions</a>, <em>ElectronicsTutorial</em>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e65f0e1adefb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>