{"id":832,"date":"2018-07-20T11:30:23","date_gmt":"2018-07-20T11:30:23","guid":{"rendered":"https:\/\/www.audero.it\/blog\/?p=832"},"modified":"2025-05-04T22:07:39","modified_gmt":"2025-05-04T22:07:39","slug":"5-javascript-interview-questions-a-mid-level-developer-should-be-able-to-answer","status":"publish","type":"post","link":"https:\/\/www.audero.it\/blog\/2018\/07\/20\/5-javascript-interview-questions-a-mid-level-developer-should-be-able-to-answer\/","title":{"rendered":"5 JavaScript interview questions a mid-level developer should be able to answer"},"content":{"rendered":"<p>According to the results of the 2018&#8217;s StackOverflow survey, <a href=\"https:\/\/survey.stackoverflow.co\/2018#technology-most-popular-technologies-all-respondents\" target=\"_blank\" rel=\"noopener\">JavaScript is the most popular technology<\/a>. The amount of job offers for JavaScript developers is constantly increasing and with more companies adopting JavaScript as their main language, it&#8217;s easy to find good ones. But before you are hired by a company, you have to demonstrate your skills and pass the interview process.<\/p>\n<p>In this article, I&#8217;ll discuss 5 JavaScript interview questions that every mid-level developer (or higher) should be able to answer. So, if JavaScript is your favorite language and you&#8217;re looking for new opportunities, or you simply want to challenge yourself with a few questions on JavaScript, read on!<br \/>\n<!--more--><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"509\" data-permalink=\"https:\/\/www.audero.it\/blog\/?attachment_id=509\" data-orig-file=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/06\/job-interview-panel.jpg\" data-orig-size=\"1250,704\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"job interview panel\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/06\/job-interview-panel-1024x577.jpg\" class=\"aligncenter size-full wp-image-509\" src=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/06\/job-interview-panel.jpg\" alt=\"job interview panel\" width=\"1250\" height=\"704\" srcset=\"https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/06\/job-interview-panel.jpg 1250w, https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/06\/job-interview-panel-300x169.jpg 300w, https:\/\/www.audero.it\/blog\/wp-content\/uploads\/2016\/06\/job-interview-panel-1024x577.jpg 1024w\" sizes=\"auto, (max-width: 1250px) 100vw, 1250px\" \/><\/p>\n<h2>Question 1: Scoping<\/h2>\n<p>Consider the following code:<\/p>\n<pre><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nfunction foo() {\n   var a = 1;\n   const b = 2;\n   let c = 3;\n\n   if (b &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt; 10) {\n      var a = 10;\n      const b = 11;\n      let c = 12;\n\n      console.log(a, b, c);\n   }\n\n   console.log(a, b, c);\n\n   console.log(d, e);\n\n   var d = 4;\n   const e = 5;\n}\n\nfoo();\n<\/pre>\n<p>What will be printed on the console?<\/p>\n<h3>Answer<\/h3>\n<p>The code above, <a href=\"https:\/\/jsbin.com\/yodujo\/edit?js,console\" target=\"_blank\" rel=\"noopener\">available on JS Bin<\/a>, prints:<\/p>\n<pre>10 11 12\n10 2 3\nUncaught ReferenceError: e is not defined\n<\/pre>\n<p>The purpose of this question is to test the candidate&#8217;s understanding of variables scoping. The code employs the <code>var<\/code> keyword, and the <code>const<\/code> and <code>let<\/code> keywords that have been introduced in ECMAScript 2015 (also known as ECMAScript 6).<\/p>\n<p>There are two main concepts the candidate has to grasp to correctly answer this question. The first one is that variables declared using <code>const<\/code> and <code>let<\/code>, unlike those declared with <code>var<\/code>, are <em>hoisted<\/em> but not initialized. Variables declared using these two keywords are in a <em>temporal dead zone<\/em> from the start of the block until the declaration is processed. This means that referencing them before they are initialized causes the JavaScript engine to throw a <code>ReferenceError<\/code> error. The second concept is that variables declared using <code>const<\/code> and <code>let<\/code> are block scoped. On the contrary, variables declared with <code>var<\/code> are function scoped, so they are available throughout the whole function they are declared in.<\/p>\n<p>Once clarified the two notions needed to answer the question, it&#8217;s easy to understand why the value of <code>a<\/code> is replaced by the value defined inside the <code>if<\/code>, while the same isn&#8217;t true for <code>b<\/code> and <code>c<\/code>. In fact, inside the <code>if<\/code> block two different <code>b<\/code> and <code>c<\/code> variables are created. So, the condition of the <code>if<\/code> is verified. The <code>b<\/code> inside the condition of the <code>if<\/code> is the one declared at the beginning of the function, so its value is 2. This explains why the first <code>console.log()<\/code> statement executed is the one inside the <code>if<\/code> and why it prints <code>10 11 12<\/code>. For these same reasons, the values printed by the second <code>console.log()<\/code> statement are <code>10 2 3<\/code>. Finally, the <code>e<\/code> variable is declared using <code>const<\/code>, thus it&#8217;s hoisted but not initialized. At the time the third <code>console.log()<\/code> statement is executed, the <code>e<\/code> variable is in a temporal dead zone, which explains the <code>ReferenceError<\/code> error thrown.<\/p>\n<p>If you want to learn more about <code>let<\/code>, <code>const<\/code>, block scope, and the temporal dead zone, I recommend you the following resources:<\/p>\n<ul>\n<li><cite><a href=\"https:\/\/2ality.com\/2015\/02\/es6-scoping.html\" target=\"_blank\" rel=\"noopener\">Variables and scoping in ECMAScript 6<\/a><\/cite><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Statements\/let\" target=\"_blank\" rel=\"noopener\"><code>let<\/code> on MDN<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Statements\/const\" target=\"_blank\" rel=\"noopener\"><code>const<\/code> on MDN<\/a><\/li>\n<\/ul>\n<h2>Question 2: Event delegation<\/h2>\n<p>Consider the following HTML snippet representing a tab system:<\/p>\n<pre><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&amp;amp;lt;div class=&amp;quot;tabs&amp;quot;&amp;amp;gt;\n   &amp;amp;lt;ul class=&amp;quot;tabs-header&amp;quot;&amp;amp;gt;\n      &amp;amp;lt;li class=&amp;quot;active&amp;quot;&amp;amp;gt;\n         &amp;amp;lt;a href=&amp;quot;#tab-1&amp;quot;&amp;amp;gt;Tab 1&amp;amp;lt;\/a&amp;amp;gt;\n      &amp;amp;lt;\/li&amp;amp;gt;\n      &amp;amp;lt;li&amp;amp;gt;\n         &amp;amp;lt;a href=&amp;quot;#tab-2&amp;quot;&amp;amp;gt;Tab 2&amp;amp;lt;\/a&amp;amp;gt;\n      &amp;amp;lt;\/li&amp;amp;gt;\n      &amp;amp;lt;li&amp;amp;gt;\n         &amp;amp;lt;a href=&amp;quot;#tab-3&amp;quot;&amp;amp;gt;Tab 3&amp;amp;lt;\/a&amp;amp;gt;\n      &amp;amp;lt;\/li&amp;amp;gt;\n   &amp;amp;lt;\/ul&amp;amp;gt;\n   &amp;amp;lt;article class=&amp;quot;tab active&amp;quot; id=&amp;quot;tab-1&amp;quot;&amp;amp;gt;\n      Content 1\n   &amp;amp;lt;\/article&amp;amp;gt;\n   &amp;amp;lt;article class=&amp;quot;tab&amp;quot; id=&amp;quot;tab-2&amp;quot;&amp;amp;gt;\n      Content 2\n   &amp;amp;lt;\/article&amp;amp;gt;\n   &amp;amp;lt;article class=&amp;quot;tab&amp;quot; id=&amp;quot;tab-3&amp;quot;&amp;amp;gt;\n      Content 3\n   &amp;amp;lt;\/article&amp;amp;gt;\n&amp;amp;lt;\/div&amp;amp;gt;\n<\/pre>\n<p>Write the JavaScript code needed to show the correct tab when the relevant tab header is selected. Both the tab and its header are considered visible if they possess the <code>active<\/code> CSS class name.<\/p>\n<h3>Answer<\/h3>\n<p>A possible implementation is listed below:<\/p>\n<pre><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nconst tabs = Array.from(document.querySelectorAll('.tab'));\nconst tabsHeaders = Array.from(document.querySelectorAll('.tabs-header li'));\n\ndocument\n   .querySelector('.tabs')\n   .addEventListener('click', function(event) {\n      \/\/ Do not execute the logic if the element selected is not an anchor\n      if (event.target.tagName !== 'A') {\n         return;\n      }\n\n      event.preventDefault();\n\n      \/\/ Remove the active class name from the previous active tab header\n      tabsHeaders.forEach(header =&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; header.classList.remove('active'));\n\n      \/\/ Add the active class name to the selected tab header\n      event\n         .target\n         .parentNode\n         .classList\n         .add('active');\n\n      \/\/ Remove the active class name from the previous active tab\n      tabs.forEach(tab =&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; tab.classList.remove('active'));\n\n      \/\/ Add the active class name to the selected active tab\n      tabs\n         .filter(tab =&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; `#${tab.id}` === event.target.getAttribute('href'))\n         .shift()\n         .classList\n         .add('active');\n   });\n<\/pre>\n<p>A complete demo of this solution is <a href=\"https:\/\/jsbin.com\/homici\/edit?html,js,output\" target=\"_blank\" rel=\"noopener\">available on JS Bin<\/a>.<\/p>\n<p>The aim of this question is to verify the knowledge of a technique called <em>event delegation<\/em>.<\/p>\n<p>To achieve the goal the candidate could be tempted to add an event listener to every tab header, but this approach would cause a waste of memory. The same result can be achieved more efficiently by employing a technique known as <em>event delegation<\/em>. Instead of adding an event listener to every tab header, the candidate can add a single event listener to the unordered list (the parent of the tab headers). Then, based on the element on which the <code>click<\/code> event is fired, the relevant tab can be shown. The latter is identified by the match between the <code>id<\/code> property of the tab and the <code>href<\/code> attribute of the selected anchor element.<\/p>\n<p>If you need an introduction to event delegation, I suggest you to read the following tutorials:<\/p>\n<ul>\n<li><cite><a href=\"https:\/\/www.audero.it\/blog\/2018\/05\/16\/event-delegation-in-javascript\/\" target=\"_blank\" rel=\"noopener\">Event delegation in JavaScript<\/a><\/cite><\/li>\n<li><cite><a href=\"https:\/\/davidwalsh.name\/event-delegate\" target=\"_blank\" rel=\"noopener\">How JavaScript Event Delegation Works<\/a><\/cite><\/li>\n<\/ul>\n<h2><code>bind()<\/code>, <code>call()<\/code>, and <code>apply()<\/code><\/h2>\n<p>What&#8217;s the difference between <code>bind()<\/code>, <code>call()<\/code>, and <code>apply()<\/code>?<\/p>\n<h3>Answer<\/h3>\n<p>All these methods belong to the <code>Function<\/code> object&#8217;s prototype which means that every function possesses these methods. They all allow to change the context of the function, that is the object referred by the <code>this<\/code> keyword, on which they operate without changing its logic. Also, they all accept the same first argument, which is the value to use as the context of the function they operate on. Having said that, let&#8217;s discuss the differences.<\/p>\n<p><code>bind()<\/code> is different from the two other methods because it returns the modified function and doesn&#8217;t execute either the function it operates on or the modified function. It can also be used to preset some of the parameters of the original function. Both <code>call()<\/code> and <code>apply()<\/code> execute the modified function and return whatever value is returned by the latter. The difference is that, in addition to the first argument discussed before, <code>call()<\/code> accepts an argument for each parameter to pass to the modified function while <code>apply()<\/code> accepts an array of arguments.<\/p>\n<p>To better understand this difference, let&#8217;s see an example that involves the use of the <code>console.log()<\/code> function to print on the console the value of two variables: <code>foo<\/code> and <code>bar<\/code>. All of the calls to <code>console.log()<\/code> below prints the same output.<\/p>\n<pre><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nvar foo = 1;\nvar bar = 2;\n\nvar log = console.log.bind(console, foo, bar);\n\nlog();\n\nconsole.log.call(console, foo, bar);\n\nconsole.log.apply(console, &#x5B;foo, bar]);\n<\/pre>\n<p>A live demo of this snippet is shown below but <a href=\"https:\/\/jsbin.com\/molopi\/edit?js,console\" target=\"_blank\" rel=\"noopener\">it&#8217;s also available on JS Bin<\/a>.<\/p>\n<p>To learn more about these three methods, you can read the following pages:<\/p>\n<ul>\n<li><cite><a href=\"https:\/\/exploringjs.com\/es5\/ch15.html#_more_control_over_function_calls_call_apply_and_bind\" target=\"_blank\" rel=\"noopener\">More Control over Function Calls: call(), apply(), and bind()<\/a><\/cite><\/li>\n<li><cite><a href=\"https:\/\/github.com\/getify\/You-Dont-Know-JS\/blob\/1st-ed\/this%20%26%20object%20prototypes\/ch2.md\" target=\"_blank\" rel=\"noopener\">Chapter 2: this All Makes Sense Now!<\/a><\/cite> of the book <cite><a href=\"https:\/\/github.com\/getify\/You-Dont-Know-JS\" target=\"_blank\" rel=\"noopener\">this &amp; Object Prototypes<\/a><\/cite><\/li>\n<\/ul>\n<h2>Question 4: Pure functions<\/h2>\n<p>Explain what pure functions are and some of their advantages.<\/p>\n<h3>Answer<\/h3>\n<p>In simple terms, a <em>pure function<\/em> is a function where the return value is only determined by its input values and that doesn&#8217;t have side effects such as the mutation of an object. This means that the function always returns the same result given the same arguments and that it doesn&#8217;t depend on a given application state that may change while the software is executed.<\/p>\n<p>An example of a pure function is the <code>test()<\/code> function reported below. It declares two parameters, an array of numbers (<code>array<\/code>) and a number (<code>max<\/code>). The function returns <code>true<\/code> if the sum of the numbers of the array is less than the number; <code>false<\/code> otherwise.<\/p>\n<pre><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nfunction test(array, max) {\n   const sum = array.reduce((partial, number) =&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; partial + number);\n   return sum &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt; max;\n}\n<\/pre>\n<p>As you can see, the returned value of the <code>test()<\/code> function is only calculated on the basis of the provided arguments. Other examples of pure functions can be found in the JavaScript language itself. Some examples are <code>Math.sin()<\/code>, <code>Math.max()<\/code>, and <code>Number.parseInt()<\/code>.<\/p>\n<p>To give you a better understanding of what pure functions are, let&#8217;s see an example of an impure function:<\/p>\n<pre><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nfunction sumRandom(number) {\n   return Math.random() + number;\n}\n<\/pre>\n<p>The <code>sumRandom()<\/code> function defined above is impure because its returned value depends on the random number calculated inside the function. So, even if we pass the same argument, at every call of the function the result will be different.<\/p>\n<p>The main advantage of pure functions is their testability. Because the return value depends on arguments provided only, you don&#8217;t have to assume or mock any state of your software and you can focus on arguments and return values. Pure functions help you in writing predictable and deterministic code, which is easier to test.<\/p>\n<p>Another advantage is that pure functions can be executed in parallel because they don&#8217;t have side effects, thus there is no chance they conflict with each other. Pure functions are also usually easier to understand and reuse because they don&#8217;t depend on a given state of the system nor they change the state of the application. Finally, results of pure functions can be cached for future reuse because the same input always yields the same output.<\/p>\n<p>If you want to learn more about pure functions I advise you to read these articles:<\/p>\n<ul>\n<li><cite><a href=\"https:\/\/medium.com\/javascript-scene\/master-the-javascript-interview-what-is-a-pure-function-d1c076bec976\" target=\"_blank\" rel=\"noopener\">Master the JavaScript Interview: What is a Pure Function?<\/a><\/cite><\/li>\n<li><cite><a href=\"https:\/\/www.sitepoint.com\/an-introduction-to-reasonably-pure-functional-programming\/\" target=\"_blank\" rel=\"noopener\">An Introduction to Reasonably Pure Functional Programming<\/a><\/cite><\/li>\n<\/ul>\n<h2>Question 5: <code>Promise<\/code>s<\/h2>\n<p>A company offers a service that generates random numbers between 1 and 1000, one number at every request. Write a <code>product()<\/code> function that accepts the amount of random numbers to generate and returns their product. You can assume the presence in the code base of a <code>getRandomNumber()<\/code> function, reported below, that returns a <code>Promise<\/code> which will resolve with the generated random number.<\/p>\n<pre><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nfunction getRandomNumber() {\n   const min = 1;\n   const max = 1000;\n   const randomNumber = Math.floor(Math.random() * (max - min + 1)) + min;\n\n   return Promise.resolve(randomNumber);\n}\n<\/pre>\n<h3>Answer<\/h3>\n<p>The goal of this question is to test the candidate&#8217;s knowledge of the <code>Promise<\/code> object and its methods in JavaScript. It also verifies that the candidate understands the challenge of synchronizing several asynchronous calls to obtain the final result.<\/p>\n<p>As always there isn&#8217;t one solution to a problem but the presented one, also <a href=\"https:\/\/jsbin.com\/nejepe\/edit?js,console\" target=\"_blank\" rel=\"noopener\">available on JS Bin<\/a>, is a good trade-off between conciseness, clever techniques, and readability.<\/p>\n<pre><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nfunction product(numbers) {\n   const randomNumbers = Array\n      .from(Array(numbers))\n      .map(() =&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; getRandomNumber());\n\n   return Promise\n      .all(randomNumbers)\n      .then(values =&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; values.reduce((prod, value) =&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; prod * value, 1));\n}\n<\/pre>\n<p>The code is made of two sections. In the first one you can see that an array of <code>numbers<\/code> length is created. The array is initially filled with <code>undefined<\/code> values (<code>Array.from(Array(numbers))<\/code>). Then, by using <code>map()<\/code>, a new array of the same length containing <code>Promise<\/code> objects is created. These objects will eventually resolve with the generated random number.<\/p>\n<p>Once created the array of <code>Promise<\/code>s, the code waits until all of them are resolved to calculate the product. The synchronization is done with the use of <code>Promise.all()<\/code>.<\/p>\n<p>If you have never used the <code>Promise<\/code> object and you need a primer on the topic, I suggest you to read the following resources:<\/p>\n<ul>\n<li><cite><a href=\"https:\/\/web.dev\/articles\/promises\" target=\"_blank\" rel=\"noopener\">JavaScript Promises<\/a><\/cite><\/li>\n<li><cite><a href=\"https:\/\/exploringjs.com\/es6\/ch_promises.html\" target=\"_blank\" rel=\"noopener\">Promises for asynchronous programming<\/a><\/cite><\/li>\n<\/ul>\n<h2>Conclusions<\/h2>\n<p>In this article I&#8217;ve discussed some JavaScript interview questions that you could be asked for a position as a JavaScript developer. Even if these are not the questions that you&#8217;ll actually be asked, they should have given you a good refresh of some important concepts. I hope you had fun testing your knowledge and that you learned a thing or two you didn&#8217;t know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>According to the results of the 2018&#8217;s StackOverflow survey, JavaScript is the most popular technology. The amount of job offers for JavaScript developers is constantly increasing and with more companies adopting JavaScript as their main language, it&#8217;s easy to find<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[56,46,57,11],"class_list":["post-832","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-interview","tag-javascript","tag-job","tag-web"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9Or4e-dq","jetpack-related-posts":[{"id":329,"url":"https:\/\/www.audero.it\/blog\/2014\/09\/19\/resources-beginner-front-end-developers\/","url_meta":{"origin":832,"position":0},"title":"Resources for Beginner Front-end Developers","author":"Aurelio De Rosa","date":"September 19, 2014","format":false,"excerpt":"Few weeks ago I received an email from a developer asking me for suggestions on how to delve into the front-end world. After having replied to this email, I thought that it'd have been nice to share the same suggestions on my blog. That's exactly what you'll find in this\u2026","rel":"","context":"In &quot;Discussions &amp; Opinions&quot;","block_context":{"text":"Discussions &amp; Opinions","link":"https:\/\/www.audero.it\/blog\/category\/discussions-opinions\/"},"img":{"alt_text":"html5 css3 javascript logos","src":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2014\/09\/front-end-stack.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2014\/09\/front-end-stack.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2014\/09\/front-end-stack.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2014\/09\/front-end-stack.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2014\/09\/front-end-stack.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":672,"url":"https:\/\/www.audero.it\/blog\/2017\/01\/18\/from-javascript-developer-to-javascript-engineer-find-all-celebrities-in-a-set-of-people\/","url_meta":{"origin":832,"position":1},"title":"From JavaScript developer to JavaScript engineer: find all celebrities in a set of people","author":"Aurelio De Rosa","date":"January 18, 2017","format":false,"excerpt":"In the first article of my series From JavaScript developer to JavaScript engineer titled From JavaScript developer to JavaScript engineer: Re-implementing ECMAScript 2015's String.prototype.repeat() method I've discussed how computer science concepts can help in writing better and more elegant software. Specifically, I've demonstrated how to use appropriate algorithms and data\u2026","rel":"","context":"In &quot;From JavaScript developer to JavaScript engineer&quot;","block_context":{"text":"From JavaScript developer to JavaScript engineer","link":"https:\/\/www.audero.it\/blog\/category\/javascript\/from-javascript-developer-to-javascript-engineer\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/12\/oscars-2014-selfie.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/12\/oscars-2014-selfie.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/12\/oscars-2014-selfie.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":637,"url":"https:\/\/www.audero.it\/blog\/2016\/12\/16\/from-javascript-developer-to-javascript-engineer-re-implementing-ecmascript-2015s-string-prototype-repeat-method\/","url_meta":{"origin":832,"position":2},"title":"From JavaScript developer to JavaScript engineer: re-implementing ECMAScript 2015&#8217;s String.prototype.repeat() method","author":"Aurelio De Rosa","date":"December 16, 2016","format":false,"excerpt":"As developers, our work is to solve problems which often implies writing code. Some of the problems we face look really simple in nature, but their simplicity leads us to write sub-optimal solutions without even realizing it. JavaScript developers come from very different backgrounds, and assuming that everyone has the\u2026","rel":"","context":"In &quot;From JavaScript developer to JavaScript engineer&quot;","block_context":{"text":"From JavaScript developer to JavaScript engineer","link":"https:\/\/www.audero.it\/blog\/category\/javascript\/from-javascript-developer-to-javascript-engineer\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/12\/time-complexity-comparison.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/12\/time-complexity-comparison.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/12\/time-complexity-comparison.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":626,"url":"https:\/\/www.audero.it\/blog\/2016\/12\/05\/monkey-patching-javascript\/","url_meta":{"origin":832,"position":3},"title":"Monkey patching in JavaScript","author":"Aurelio De Rosa","date":"December 5, 2016","format":false,"excerpt":"When working on a project, we often use libraries that implement methods that aren't built-in in the programming language in use but we need. These libraries don't cover all the possible methods, so they might lack one or more crucial features we need. When this happens, we have two choices:\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/www.audero.it\/blog\/category\/javascript\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/12\/monkey-patching.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":612,"url":"https:\/\/www.audero.it\/blog\/2016\/11\/29\/most-used-npm-commands\/","url_meta":{"origin":832,"position":4},"title":"My most used npm commands","author":"Aurelio De Rosa","date":"November 29, 2016","format":false,"excerpt":"If you're a front-end or a JavaScript developer, you're surely using npm. npm is a registry where people publish their software. At the beginning, it was used to share JavaScript libraries and frameworks, but today you can also find CSS frameworks, font icons, and much more. In addition to being\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/www.audero.it\/blog\/category\/javascript\/"},"img":{"alt_text":"npm","src":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.audero.it\/blog\/wp-content\/uploads\/2016\/11\/npm.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":375,"url":"https:\/\/www.audero.it\/blog\/2015\/06\/05\/trick-of-the-day-memoization-in-javascript\/","url_meta":{"origin":832,"position":5},"title":"Trick of the day: Memoization in JavaScript","author":"Aurelio De Rosa","date":"June 5, 2015","format":false,"excerpt":"Functions in JavaScript are really different from many other languages as they are first-class citizens. What this means is that they are treated like any other data type, including objects (actually they are objects), and as such functions can possess properties and even functions, can be assigned to variables, and\u2026","rel":"","context":"In &quot;Trick of the day&quot;","block_context":{"text":"Trick of the day","link":"https:\/\/www.audero.it\/blog\/category\/trick-of-the-day\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/posts\/832","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/comments?post=832"}],"version-history":[{"count":25,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/posts\/832\/revisions"}],"predecessor-version":[{"id":1054,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/posts\/832\/revisions\/1054"}],"wp:attachment":[{"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/media?parent=832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/categories?post=832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.audero.it\/blog\/wp-json\/wp\/v2\/tags?post=832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}