{"id":333,"date":"2020-10-14T06:30:03","date_gmt":"2020-10-14T06:30:03","guid":{"rendered":"https:\/\/thenextweb.com\/?p=1323000"},"modified":"2020-10-14T06:30:03","modified_gmt":"2020-10-14T06:30:03","slug":"here-are-the-20-javascript-questions-youll-be-asked-in-your-next-interview","status":"publish","type":"post","link":"https:\/\/www.londonchiropracter.com\/?p=333","title":{"rendered":"Here are the 20 JavaScript questions you\u2019ll be asked in your next interview"},"content":{"rendered":"\n<p>An&nbsp;interview&nbsp;is an important part of the&nbsp;hiring process. It gives insights about the skillset, knowledge, and the ability of an individual to take on challenging tasks. It\u2019s also one of the most reliable ways for an employer to filter out unsuitable candidates for a job posting.<\/p>\n<p>As a&nbsp;JavaScript developer, you must prepare yourself before appearing in an exam or an interview. It\u2019ll increase your chances of getting hired by a reputed company.<\/p>\n<p>Now, you might be wondering where to start when it comes to preparation and getting familiar with the kind of questions that\u2019ll be thrown your way. So, to help you out, I\u2019ve compiled a list of commonly asked&nbsp;JavaScript interview questions. Each of these questions has a&nbsp;brief answer&nbsp;which you can review below.<\/p>\n<p>In the end, you\u2019ll be a bit more prepared and confident to answer any question your interviewer may ask. So, let\u2019s get started.<\/p>\n<h2 id=\"1--what-is-javascript\">First of all, what is JavaScript?<\/h2>\n<p>JavaScript is a scripting language created by Netscape in 1995. It was initially used on a popular web browser called \u2018Netscape Navigator. \u2018But, these days, we can use it for client-side as well as server-side application development.<\/p>\n<p>Well\u2026 I don\u2019t think someone will ask this, but we shouldn\u2019t forget where JavaScript comes from.<\/p>\n<h2 id=\"2--list-some-advantages-of-javascript\">Can you list some advantages of JavaScript?<\/h2>\n<ul>\n<li>JavaScript can work offline inside the web browser.<\/li>\n<li>It supports multiple programming paradigms. For example, we can make use of Object-Oriented, Functional, and Imperative programming concepts.<\/li>\n<li>It has the biggest collection of open source libraries and frameworks.<\/li>\n<li>JavaScript is capable of creating online and&nbsp;offline games, desktop software, websites, and mobile apps.<\/li>\n<li>No need to learn separate programming languages to create frontend and backend of a website. JavaScript is supported on all major web browsers and it can run on the server using Node.js.<\/li>\n<li>It is an interpreted language. Meaning we don\u2019t have to build or compile its code before use. JavaScript instructions execute directly.<\/li>\n<\/ul>\n<h2 id=\"3--should-we-use-internal-or-external-javascript\">Should we use internal or external JavaScript?<\/h2>\n<p>Internal JavaScript is more suitable when we just need to use it on a single web page. Whereas, always use an external JavaScript file for websites that have multiple web pages.<\/p>\n<h2 id=\"4--why-wordpress-plugins-like-autoptimize-aggregate-javascript-code-in-one-file\">Why do WordPress plugins like Autoptimize aggregate JavaScript Code in one file?<\/h2>\n<p>Aggregation of JavaScript source code in a single file reduces the number of requests made to the server while generating a web page. In turn, it makes a website load faster.<\/p>\n<p>For example, let\u2019s say we\u2019ve included ten&nbsp;JavaScript files on a web page. Now, when we open this web page our web browser sends ten&nbsp;HTTP requests to the server in order to retrieve these files. On the other hand, if we aggregate the code of all these files into one then we just need to make one request to the server.<\/p>\n<h2 id=\"5--what-is-javascript-hoisting\">What is JavaScript \u2018hoisting?<\/h2>\n<p>Hoisting is a concept in JavaScript which allows us to use variables and functions even before they are declared.<\/p>\n<p>Basically, when we execute a JavaScript code then at first it automatically extracts all variable and function declarations from the code and moves them to the top of their scope. After that, it starts executing the code.<\/p>\n<p>The major benefit of hoisting&nbsp;is our code works correctly and doesn\u2019t display any errors like&nbsp;\u201cundefined variable\u201d&nbsp;or&nbsp;\u201cundefined function.\u201d<\/p>\n<p>Learn more about hoisting with my article&nbsp;\u2018<a href=\"https:\/\/livecodestream.dev\/post\/2020-07-25-understanding-variables-scope-and-hoisting-in-javascript\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Understanding Variables, Scope, and Hoisting in JavaScript<\/a>.\u2019<\/p>\n<h2 id=\"6--predict-the-output-of-the-following-code\">Can you predict the output of the following code?<\/h2>\n<p>Code:<\/p>\n<p><span><\/p>\n<figure class=\"post-image post-mediaBleed alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1323039 lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.10.22-PM.png\" alt width=\"692\" height=\"189\" sizes=\"(max-width: 692px) 100vw, 692px\" data-lazy=\"true\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.10.22-PM.png 692w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.10.22-PM-280x76.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.10.22-PM-540x147.png 540w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.10.22-PM-270x74.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.10.22-PM-687x189.png 687w\"><\/figure>\n<p><\/span><\/p>\n<p>Output:<\/p>\n<pre><code>Juan Cruz Martinez <\/code><\/pre>\n<p>Explanation:<\/p>\n<ul>\n<li>First of all, the variable declaration at&nbsp;line # 2&nbsp;and&nbsp;line # 3&nbsp;will be considered as one statement.<\/li>\n<li>Now, the concept of hoisting will be applied. Meaning&nbsp;JavaScript will move the variable declaration to the top. After that, the code will be executed.<\/li>\n<li>Also, remember that the value stored in a variable will not be lost even if we redeclare the variable.<\/li>\n<\/ul>\n<h2 id=\"7--what-is-javascript-strict-mode\">What is JavaScript \u2018Strict Mode\u2019?<\/h2>\n<p>The default behavior of JavaScript is very forgiving in case we make a minor mistake. It means it will not display any error messages. But, sometimes in development, we need to see all kinds of errors and warnings to debug the code.<\/p>\n<p>Here comes the use of \u201cStrict Mode\u201d in JavaScript. Basically, it\u2019s a restricted variant where JavaScript displays all errors and warnings, even if they are silent ones.<\/p>\n<p>We can enable \u201cStrict Mode\u201d by using the&nbsp;<code>\"use strict\";<\/code>&nbsp;directive at the beginning of our script.<\/p>\n<h2 id=\"8--what-are-some-alternatives-to-svelte\">What are some alternatives to Svelte?<\/h2>\n<p>Svelte is a front-end development framework for the JavaScript programming language. Some of its popular alternatives include:<\/p>\n<ul>\n<li>React<\/li>\n<li>Vue.js<\/li>\n<li>Angular<\/li>\n<\/ul>\n<h2 id=\"9--what-are-self-invoking-functions\">What are \u2018Self Invoking Functions\u2019?<\/h2>\n<p>Self Invoking Functions are a little different from normal functions because they are executed immediately where they were declared.<\/p>\n<p>Normally, we first declare a function and later just call it. But, JavaScript automatically executes the code of&nbsp;Self Invoking Functions&nbsp;at run-time.<\/p>\n<p>A point to be noted is that these functions do not have any name. In turn, we are unable to recall these types of functions. They are also known as \u201cAnonymous Functions\u201d.<\/p>\n<p>Here\u2019s an example of Self Invoking Functions:<\/p>\n<p><span><\/p>\n<figure class=\"post-image post-mediaBleed alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1323040 lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.14.16-PM.png\" alt width=\"701\" height=\"225\" sizes=\"(max-width: 701px) 100vw, 701px\" data-lazy=\"true\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.14.16-PM.png 701w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.14.16-PM-280x90.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.14.16-PM-540x173.png 540w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.14.16-PM-270x87.png 270w\"><\/figure>\n<p><\/span><\/p>\n<h2 id=\"10--what-is-the-difference-between-var-let-and-const\">What is the difference between \u2018var,\u2019 \u2018let,\u2019 and \u2018const\u2019?<\/h2>\n<h2>\n<figure class=\"post-image post-mediaBleed alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1323041 lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.14.31-PM.png\" alt width=\"702\" height=\"492\" sizes=\"(max-width: 702px) 100vw, 702px\" data-lazy=\"true\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.14.31-PM.png 702w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.14.31-PM-280x196.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.14.31-PM-385x270.png 385w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.14.31-PM-193x135.png 193w\"><\/figure>\n<\/h2>\n<p>Learn more about them in my article&nbsp;\u2018<a href=\"https:\/\/livecodestream.dev\/post\/2020-07-25-understanding-variables-scope-and-hoisting-in-javascript\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Understanding Variables, Scope, and Hoisting in JavaScript<\/a>.\u2019<\/p>\n<h2>What is the difference between \u2018==\u2019 and \u2018===\u2019?<\/h2>\n<p>Both of them are used in JavaScript to perform a comparison between two values.<\/p>\n<p><figure class=\"post-image post-mediaBleed alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1323042 lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.16.14-PM.png\" alt width=\"696\" height=\"211\" sizes=\"(max-width: 696px) 100vw, 696px\" data-lazy=\"true\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.16.14-PM.png 696w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.16.14-PM-280x85.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.16.14-PM-540x164.png 540w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.16.14-PM-270x82.png 270w\"><\/figure>\n<\/p>\n<h2>Is there any difference between \u2018null\u2019 and \u2018undefined\u2019 keywords?<\/h2>\n<p><span>Both of these keywords represent an empty value<\/span><span>. But, there are two basic differences between&nbsp;null&nbsp;and&nbsp;undefined<\/span><span>.<\/span><\/p>\n<p><figure class=\"post-image post-mediaBleed alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1323043 lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.17.20-PM.png\" alt width=\"697\" height=\"189\" sizes=\"(max-width: 697px) 100vw, 697px\" data-lazy=\"true\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.17.20-PM.png 697w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.17.20-PM-280x76.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.17.20-PM-540x146.png 540w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.17.20-PM-270x73.png 270w\"><\/figure>\n<\/p>\n<h2>Can you tell the difference between \u2018function declaration\u2019 and \u2018function expression\u2019?<\/h2>\n<p><span>Basically, \u2018Function Declaration<\/span>\u2018<span>&nbsp;is nothing but the normal process<\/span><span> of defining a function using the keyword<span><\/span>&nbsp;<\/span><code>function<\/code><span>, its unique name<\/span><span>, parameters, and the function body. Whereas, when we assign a function<\/span> declaration<span> to a variable<\/span><span> then it becomes \u2018Function Expression.\u2019&nbsp;<\/span>It\u2019s interesting to note that function expressions are not hoisted, meaning, they\u2019ll display an error if you try to call them before defining.<\/p>\n<p>Function Declaration:<\/p>\n<p><span><\/p>\n<figure class=\"post-image post-mediaBleed alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1323045 lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.18.49-PM.png\" alt width=\"692\" height=\"190\" sizes=\"(max-width: 692px) 100vw, 692px\" data-lazy=\"true\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.18.49-PM.png 692w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.18.49-PM-280x77.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.18.49-PM-540x148.png 540w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.18.49-PM-270x74.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.18.49-PM-687x190.png 687w\"><\/figure>\n<p><\/span><\/p>\n<p>Function Expression:<\/p>\n<p><span><\/p>\n<figure class=\"post-image post-mediaBleed alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1323046 lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.19.02-PM.png\" alt width=\"697\" height=\"196\" sizes=\"(max-width: 697px) 100vw, 697px\" data-lazy=\"true\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.19.02-PM.png 697w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.19.02-PM-280x79.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.19.02-PM-540x152.png 540w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.19.02-PM-270x76.png 270w\"><\/figure>\n<p><\/span><\/p>\n<h2 id=\"14--what-is-a-closure\">What is a \u2018Closure\u2019?<\/h2>\n<p>A \u2018closure\u2019 in JavaScript is a function inside another function. The inner function has access to its own variables, the variables defined in the outer function as well as the global variables.<\/p>\n<p>Closure Example:<\/p>\n<p><span><\/p>\n<figure class=\"post-image post-mediaBleed alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1323047 lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.04-PM.png\" alt width=\"683\" height=\"605\" sizes=\"(max-width: 683px) 100vw, 683px\" data-lazy=\"true\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.04-PM.png 683w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.04-PM-237x210.png 237w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.04-PM-305x270.png 305w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.04-PM-152x135.png 152w\"><\/figure>\n<p><\/span><\/p>\n<h2 id=\"15--predict-the-output-of-these-two-functions-will-they-return-same-the-output-or-not\">Can you predict the output of these two functions? And will they return same the output or not?<\/h2>\n<p><figure class=\"post-image post-mediaBleed alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1323048 lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.23-PM.png\" alt width=\"693\" height=\"621\" sizes=\"(max-width: 693px) 100vw, 693px\" data-lazy=\"true\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.23-PM.png 693w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.23-PM-234x210.png 234w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.23-PM-301x270.png 301w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.23-PM-151x135.png 151w\"><\/figure>\n<\/p>\n<p>Output of Function user1()<\/p>\n<pre><code>{name: \"Juan\"} <\/code><\/pre>\n<p>Output of Function user2()<\/p>\n<pre><code>undefined <\/code><\/pre>\n<h2 id=\"16--what-is-nan\">What is \u2018NaN\u2019?<\/h2>\n<p>In JavaScript,&nbsp;NaN&nbsp;stands for&nbsp;\u201cNot a Number.\u201d It\u2019s a special value that occurs when we\u2019re unable to perform an operation.<\/p>\n<p>For example, what if we try to divide a string using a number (e.g. \u201cHello World\u201d \/ 5).<\/p>\n<h2 id=\"17--explain-the-for-in-loop\">Can you explain the for-in loop?<\/h2>\n<p>The for-in loop is specifically designed to loop through all the object\u2019s properties in a step by step manner. It selects one property from the object in each iteration and performs the required operations on it.<\/p>\n<p>Let\u2019s try to understand it with the help of an example:<\/p>\n<p><span><\/p>\n<figure class=\"post-image post-mediaBleed alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1323049 lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.44-PM.png\" alt width=\"692\" height=\"484\" sizes=\"(max-width: 692px) 100vw, 692px\" data-lazy=\"true\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.44-PM.png 692w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.44-PM-280x196.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.44-PM-386x270.png 386w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.20.44-PM-193x135.png 193w\"><\/figure>\n<p><\/span><\/p>\n<p>Output:-<\/p>\n<pre><code>name -&gt; Juan country -&gt; Germany website -&gt; livecodestream.dev <\/code><\/pre>\n<h2 id=\"18--what-is-event-bubbling-and-capturing\">What\u2019s \u2018Event Bubbling\u2019 and \u2018Capturing\u2019?<\/h2>\n<p>In JavaScript DOM, HTML elements are nested inside one another to form a hierarchy.<\/p>\n<p>Now, if both parent and child elements have registered a handle for a specific event then what will be the order of event propagation?<\/p>\n<p>It can be determined in two ways which are known as event bubbling and capturing.<\/p>\n<p>In event bubbling, the child element will capture the event first and then propagate it to parent elements. Whereas, in event capturing, the parent element will capture the event first and then propagate it to the child elements.<\/p>\n<h2 id=\"19--what-is-the-difference-between-javascript-and-ecma-script\">What\u2019s the difference between JavaScript and ECMA Script?<\/h2>\n<p>JavaScript is a scripting language whereas ECMA Script is a collection of guidelines and rules to standardize JavaScript across different web browsers.<\/p>\n<h2 id=\"20--how-to-create-a-cookie-using-javascript\">How do you create a cookie using JavaScript?<\/h2>\n<p>In JavaScript, a cookie can be created using a&nbsp;document.cookie&nbsp;object. Simply assign it a string value that is just a series of key-value pairs separated with semi-colons.<\/p>\n<p>JavaScript Create Cookie Example:<\/p>\n<p><span><\/p>\n<figure class=\"post-image post-mediaBleed alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1323050 lazy\" src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.21.08-PM.png\" alt width=\"689\" height=\"121\" sizes=\"(max-width: 689px) 100vw, 689px\" data-lazy=\"true\" data-srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.21.08-PM.png 689w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.21.08-PM-280x49.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.21.08-PM-540x95.png 540w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.21.08-PM-270x47.png 270w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2020\/10\/Screen-Shot-2020-10-13-at-2.21.08-PM-687x121.png 687w\"><\/figure>\n<p><\/span><\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>Employers usually try to confuse the applicants by asking tricky questions. So, if you\u2019re not well-prepared then chances are you\u2019ll end up losing the opportunity.<\/p>\n<p>So, today, I tried to answer some commonly asked&nbsp;JavaScript interview questions. You may even use it as a reference just before going to an interview.<\/p>\n<hr>\n<p><i><span>This <\/span><\/i><a href=\"https:\/\/livecodestream.dev\/post\/2020-10-05-20-common-javascript-interview-questions\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><i><span>article<\/span><\/i><\/a><i><span> was originally published on <\/span><\/i><a href=\"https:\/\/livecodestream.dev\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><i><span>Live Code Stream<\/span><\/i><\/a><i><span> by <\/span><\/i><a href=\"https:\/\/www.linkedin.com\/in\/bajcmartinez\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><i><span>Juan Cruz Martinez<\/span><\/i><\/a><i><span> (twitter: <\/span><\/i><a href=\"https:\/\/twitter.com\/bajcmartinez\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><i><span>@bajcmartinez<\/span><\/i><\/a><i><span>), founder and publisher of Live Code Stream, entrepreneur, developer, author, speaker, and doer of things.<\/span><\/i><\/p>\n<p><a href=\"https:\/\/livecodestream.dev\/subscribe\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><i><span>Live Code Stream<\/span><\/i><\/a><i><span> is also available as a free weekly newsletter. Sign up for updates on everything related to programming, AI, and computer science in general.<\/span><\/i><\/p>\n<p class=\"c-post-pubDate\"> Published October 14, 2020 \u2014 06:30 UTC <\/p>\n<p> <a href=\"https:\/\/thenextweb.com\/growth-quarters\/2020\/10\/14\/here-are-the-20-javascript-questions-youll-be-asked-in-your-next-interview-syndicaton\/\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>An&nbsp;interview&nbsp;is an important part of the&nbsp;hiring process. It gives insights about the skillset, knowledge, and the ability of an individual to take on challenging tasks. It\u2019s also one of the most reliable&#8230;<\/p>\n","protected":false},"author":1,"featured_media":334,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/posts\/333"}],"collection":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=333"}],"version-history":[{"count":0,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/posts\/333\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=\/wp\/v2\/media\/334"}],"wp:attachment":[{"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.londonchiropracter.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}