{"id":46663,"date":"2025-05-05T18:08:04","date_gmt":"2025-05-05T12:38:04","guid":{"rendered":"https:\/\/www.foundit.sg\/career-advice\/?p=46663"},"modified":"2025-09-29T12:38:20","modified_gmt":"2025-09-29T07:08:20","slug":"javascript-es6-features-for-interviews","status":"publish","type":"post","link":"https:\/\/www.foundit.sg\/career-advice\/javascript-es6-features-for-interviews\/","title":{"rendered":"JavaScript ES6+ Features You Must Know for Interviews in 2026"},"content":{"rendered":"\n<p><!-- wp:paragraph -->\r\n<p>JavaScript\u2019s come a long way, and if you\u2019re aiming for a<a href=\"https:\/\/www.foundit.sg\/search\/javascript-jobs\" target=\"_blank\" rel=\"noopener\" title=\"\"> <strong>JavaScript developer job in Singapore<\/strong><\/a>, it\u2019s no longer enough to just \"know the basics.\"<br>Whether you\u2019re applying to fast-paced <strong>tech startups at LaunchPad One-North<\/strong> or eyeing a role at big players like <strong>Shopee<\/strong> and <strong>Sea Group<\/strong>, understanding <strong>modern JavaScript ES6 features<\/strong> gives you a real advantage.<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>Technical interviews today aren\u2019t about textbook answers \u2014 they\u2019re about showing you can think in <strong>clean, scalable JavaScript<\/strong>. Concepts like <strong>destructuring assignment<\/strong>, <strong>async\/await<\/strong>, and choosing between <strong>let vs const<\/strong> aren\u2019t just nice-to-know skills anymore \u2014 they're expected as part of strong <a href=\"https:\/\/www.foundit.sg\/career-advice\/javascript-interview-questions-and-answers\/\" target=\"_blank\" rel=\"noopener\" title=\"\"><strong>JavaScript interview preparation<\/strong>.<\/a><\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>This guide breaks down the <strong>most important ES6+ JavaScript features<\/strong> that show up over and over again in real-world interviews \u2014 explained simply, with examples you\u2019ll actually remember.<br>If you\u2019re serious about standing out and landing that next big opportunity, let\u2019s dive right into the world of <strong>JavaScript ES6 interview success<\/strong>.<\/p><!-- \/wp:paragraph -->                <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Table of Contents<\/h2>\n\n\n\n<ol style=\"background-color:#abb7c245\" class=\"wp-block-list has-background\">\n<li><a href=\"#toc-variable-declarations\"><strong>Variable Declarations: var, let, and const<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#toc-arrow-functions\"><strong>Arrow Functions<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#toc-template-literals\"><strong>Template Literals<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#toc-destructuring-assignment\"><strong>Destructuring Assignment<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#toc-spread-rest-operators\"><strong>Spread and Rest Operators<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#toc-default-parameters\"><strong>Default Parameters<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#toc-enhanced-object-literals\"><strong>Enhanced Object Literals<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#toc-promises-async-await\"><strong>Promises and Async\/Await<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#toc-classes-inheritance\"><strong>Classes and Inheritance<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#toc-modules-import-export\"><strong>Modules: import and export<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#toc-other-important-es6-features\"><strong>Other Important ES6+ Features<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#toc-emerging-features-es2020-2025\"><strong>Bonus: Emerging Features from ES2020\u20132026<\/strong><\/a><\/li>\n<\/ol>\n\n\n\n<div style=\"height: 15px;\"><\/div>\n\n<div style=\"text-align: center;\">\n<a style=\"display: inline-block;background-color: #7900c6;color: #fff;text-align: center;padding: 10px 20px;text-decoration: none;font-size: 18px;border-radius: 4px;font-weight: bold;\" href=\"https:\/\/www.foundit.sg\/search\/javascript-jobs\/utm_source=organic&#038;utm_medium=career-advice&#038;utm_campaign=javascript-es6-features\" target=\"_blank\">Apply for Javascript Jobs<\/a>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-variable-declarations\">1. Variable Declarations: var, let, and const<\/h2>\n\n\n\n<p>One of the foundational changes introduced in ES6 was the new ways to declare variables using <code>let<\/code> and <code>const<\/code> instead of the traditional <code>var<\/code>. Understanding these distinctions is crucial for writing predictable, bug-free JavaScript code.<\/p>\n\n\n\n<p>In modern JavaScript, the evolution from <code>var<\/code> to <code>let<\/code> and <code>const<\/code> is vital for writing cleaner code, especially in <strong><a href=\"https:\/\/www.foundit.sg\/career-advice\/java-interview-questions-and-answers-for-freshers-experienced\/\" target=\"_blank\" rel=\"noopener\" title=\"\">interviews for Java developers<\/a><\/strong>. These changes help developers avoid common pitfalls and ensure more predictable variable management. If you\u2019re preparing for <strong>Java Developer Jobs<\/strong>, understanding variable scoping is crucial<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.1 var<\/h3>\n\n\n\n<p><code>var<\/code> declarations are function-scoped, meaning a variable declared with <code>var<\/code> is accessible throughout the enclosing function. If declared outside a function, it becomes globally scoped. It also supports hoisting, but the variable is initialized with <code>undefined<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function example()  \nexample();\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">1.2 let<\/h3>\n\n\n\n<p><code>let<\/code> is block-scoped, meaning it is only accessible within the nearest pair of curly braces (<code> <\/code>). It also supports hoisting but does not initialize the variable, leading to a <strong>ReferenceError<\/strong> if accessed before declaration (Temporal Dead Zone).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> \n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">1.3 const<\/h3>\n\n\n\n<p><code>const<\/code> behaves similarly to <code>let<\/code> with block-scope behavior. However, variables declared with <code>const<\/code> must be initialized at the time of declaration and cannot be reassigned.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const pi = 3.14;\npi = 3.1415; \/\/ TypeError\n<\/code><\/pre>\n\n\n\n<p><strong>Pro Tip:<\/strong> Always default to <code>const<\/code> unless you specifically need to reassign a variable with <code>let<\/code>.<\/p>\n\n\n\n<p><strong>Common Mistake:<\/strong> Developers often think <code>const<\/code> makes an object immutable. Only the reference is immutable, not the contents. You can still modify the properties of a <code>const<\/code> object.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const user =  ;\nuser.name = \"Bob\"; \/\/ This is allowed\n<\/code><\/pre>\n\n\n\n<p class=\"has-background\" style=\"background-color:#ffdeed\"><strong>Related Read: <a href=\"https:\/\/www.foundit.sg\/career-advice\/nodejs-interview-questions-answers\/\" target=\"_blank\" rel=\"noopener\" title=\"\">100+ Node.js Interview Questions and Answers [ 2026 ]<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-arrow-functions\">2. Arrow Functions<\/h2>\n\n\n\n<p>Arrow functions, introduced in ES6, offer a concise syntax for writing function expressions. They are not just syntactic sugar \u2014 they have important behavioral differences, especially regarding the <code>this<\/code> keyword.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.1 Syntax of Arrow Functions<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>const add = (a, b) =&gt; a + b;\n<\/code><\/pre>\n\n\n\n<p>If the function body contains only a single expression, the braces and <code>return<\/code> statement can be omitted. For more complex bodies, use braces and a <code>return<\/code> keyword.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const multiply = (a, b) =&gt;  ;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.2 Behavior of this<\/h3>\n\n\n\n<p>Arrow functions do not bind their own <code>this<\/code>. Instead, they inherit <code>this<\/code> from the surrounding (lexical) scope. This makes them ideal for callbacks and event listeners in many cases.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function Counter()  , 1000);\n}\nnew Counter();\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.3 When Not to Use Arrow Functions<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>When you need dynamic binding of <code>this<\/code> (e.g., in object methods)<\/li>\n\n\n\n<li>When creating constructor functions (arrow functions cannot be used as constructors)<\/li>\n<\/ul>\n\n\n\n<p><strong>Pro Tip:<\/strong> Use arrow functions for non-method callbacks like <code>map<\/code>, <code>filter<\/code>, or <code>forEach<\/code> \u2014 they result in cleaner, more maintainable code.<\/p>\n\n\n\n<p><strong>Common Mistake:<\/strong> Accidentally using arrow functions for object methods where <code>this<\/code> needs dynamic binding can lead to unexpected behavior.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const user =  `) \/\/ 'this' is not the user object!\n};\nuser.greet(); \/\/ Output: Hello, undefined\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-template-literals\">3. Template Literals<\/h2>\n\n\n\n<p>Template literals are one of the most loved ES6 features that simplify string operations significantly. Instead of tedious concatenations, you can now create strings that are dynamic, readable, and multi-line.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3.1 Syntax<\/h3>\n\n\n\n<p>Enclosed by backticks (&#8220; ` &#8220;), template literals allow embedded expressions inside <code>$ <\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const name = \"Alice\";\nconsole.log(`Hello, $ !`);\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3.2 Multi-line Strings<\/h3>\n\n\n\n<p>Template literals automatically handle multi-line strings without needing escape characters like <code>\\n<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const message = `Hello,\nThis is a\nmulti-line string.`;\nconsole.log(message);\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3.3 Expression Interpolation<\/h3>\n\n\n\n<p>Besides variables, you can insert any valid JavaScript expression inside template literals.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const a = 5;\nconst b = 10;\nconsole.log(`Sum of a and b is $ `);\n<\/code><\/pre>\n\n\n\n<p><strong>Pro Tip:<\/strong> Template literals are particularly powerful in generating dynamic HTML structures when working with frontend JavaScript frameworks.<\/p>\n\n\n\n<p><strong>Common Mistake:<\/strong> Forgetting to use backticks (&#8220; ` &#8220;) and mistakenly using single or double quotes (&#8221; or &#8216;) results in a syntax error when trying to interpolate variables.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const name = \"Alice\";\nconsole.log(\"Hello, $ \"); \/\/ Incorrect! Won't interpolate.\n<\/code><\/pre>\n\n\n\n<p class=\"has-background\" style=\"background-color:#ffdeed\"><strong>Related Read: <a href=\"https:\/\/www.foundit.sg\/career-advice\/react-js-interview-questions-answers\/\" target=\"_blank\" rel=\"noopener\" title=\"\">React JS Interview Questions and Answers [ 2026 ]<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-destructuring-assignment\">4. Destructuring Assignment<\/h2>\n\n\n\n<p>Destructuring allows you to extract values from arrays and objects, making your code shorter and more readable. It\u2019s frequently tested in <strong>programming interviews<\/strong>, particularly for developers applying for <a href=\"https:\/\/www.foundit.sg\/search\/java-developer-jobs\" target=\"_blank\" rel=\"noopener\" title=\"\"><strong>Java Developer Jobs<\/strong>.<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4.1 Array Destructuring<\/h3>\n\n\n\n<p>Extract array elements into variables based on position.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const numbers = &#091;10, 20, 30];\nconst &#091;first, second, third] = numbers;\nconsole.log(first, second, third); \/\/ 10 20 30\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4.2 Object Destructuring<\/h3>\n\n\n\n<p>Extract properties based on their key names.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const user =  ;\nconst   = user;\nconsole.log(name, age); \/\/ Alice 25\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4.3 Nested Destructuring<\/h3>\n\n\n\n<p>Access deeply nested properties easily.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const person =  \n};\nconst   } = person;\nconsole.log(city); \/\/ New York\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Pro Tip:<\/h3>\n\n\n\n<p>Use default values during destructuring to handle cases where the property might be undefined.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const   = user;\nconsole.log(role); \/\/ Guest\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Common Mistake:<\/h3>\n\n\n\n<p>Forgetting to use the correct key name when destructuring objects results in <code>undefined<\/code> values.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const   = user;\nconsole.log(username); \/\/ undefined\n<\/code><\/pre>\n\n\n\n<p class=\"has-background\" style=\"background-color:#ffdeed\"><strong>Related Read: <a href=\"https:\/\/www.foundit.sg\/career-advice\/html-and-css-interview-questions-with-answers\/\" target=\"_blank\" rel=\"noreferrer noopener\">HTML and CSS Interview Questions &amp; Answers [ 2026 ]<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-spread-rest-operators\">5. Spread and Rest Operators<\/h2>\n\n\n\n<p>The spread (<code>...<\/code>) and rest (<code>...<\/code>) operators are powerful tools for working with arrays, objects, and function parameters. They provide flexibility and make the code cleaner and more expressive.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5.1 Spread Operator<\/h3>\n\n\n\n<p>Expands elements of an array or object into individual elements.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const arr1 = &#091;1, 2, 3];\nconst arr2 = &#091;...arr1, 4, 5];\nconsole.log(arr2); \/\/ &#091;1, 2, 3, 4, 5]\n\nconst obj1 =  ;\nconst obj2 =  ;\nconsole.log(obj2); \/\/  \n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5.2 Rest Operator<\/h3>\n\n\n\n<p>Collects remaining elements into an array or object.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const &#091;first, ...others] = &#091;1, 2, 3, 4];\nconsole.log(first); \/\/ 1\nconsole.log(others); \/\/ &#091;2, 3, 4]\n\nfunction sum(...nums)  \nconsole.log(sum(1, 2, 3)); \/\/ 6\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Pro Tip:<\/h3>\n\n\n\n<p>Use the spread operator to clone arrays and objects without affecting the original data \u2014 especially critical in functional programming and React state management.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Common Mistake:<\/h3>\n\n\n\n<p>Confusing spread and rest syntax: both use <code>...<\/code>, but spread is used in function calls or literals, while rest is used in function parameters and destructuring assignments.<\/p>\n\n\n\n<p>&#8212;<\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#ffdeed\"><strong>Read Also: <a href=\"https:\/\/www.foundit.sg\/career-advice\/cypress-interview-questions\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Most Asked Cypress Interview Questions<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-default-parameters\">6. Default Parameters<\/h2>\n\n\n\n<p>Default parameters allow you to specify default values for function arguments if no value or <code>undefined<\/code> is passed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function greet(name = \"Guest\")  !`;\n}\nconsole.log(greet()); \/\/ Hello, Guest!\nconsole.log(greet(\"Alice\")); \/\/ Hello, Alice!\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6.1 Why Default Parameters Matter<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Eliminate redundant checks inside functions<\/li>\n\n\n\n<li>Improve readability and code safety<\/li>\n\n\n\n<li>Help avoid <code>undefined<\/code> values when parameters are optional<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">6.2 Default Parameters with Destructuring<\/h3>\n\n\n\n<p>Combine default parameters with destructuring for maximum power.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function createUser(  =  )   is $  years old.`;\n}\nconsole.log(createUser( )); \/\/ Bob is 18 years old\nconsole.log(createUser()); \/\/ Anonymous is 18 years old\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Pro Tip:<\/h3>\n\n\n\n<p>Always list parameters with defaults at the end of the parameter list to avoid unexpected behavior.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Common Mistake:<\/h3>\n\n\n\n<p>Misunderstanding default parameters when an argument is passed explicitly as <code>null<\/code> \u2014 only <code>undefined<\/code> triggers the default value, not <code>null<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function greet(name = \"Guest\")  \ngreet(undefined); \/\/ Guest\ngreet(null); \/\/ null (NOT Guest)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-enhanced-object-literals\">7. Enhanced Object Literals<\/h2>\n\n\n\n<p>ES6 introduced several enhancements to object literals that make creating and working with objects faster, cleaner, and more powerful. This is crucial for writing modern, maintainable JavaScript code, especially during interviews where clean syntax is evaluated.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">7.1 Property Shorthand<\/h3>\n\n\n\n<p>If the key and the variable name are the same, you can use shorthand syntax.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const name = \"Alice\";\nconst age = 25;\nconst user =  ;\nconsole.log(user); \/\/  \n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7.2 Method Shorthand<\/h3>\n\n\n\n<p>You can define functions inside objects without the <code>function<\/code> keyword.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const user =  \n};\nconsole.log(user.greet());\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7.3 Computed Property Names<\/h3>\n\n\n\n<p>You can dynamically compute property keys inside objects using square brackets.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const prop = \"id\";\nconst user =  ;\nconsole.log(user); \/\/  \n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Pro Tip:<\/h3>\n\n\n\n<p>Use computed property names for dynamic keys in APIs or configuration objects, which is common in real-world development.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Common Mistake:<\/h3>\n\n\n\n<p>Forgetting to wrap dynamic keys in square brackets results in literal property names instead of evaluated expressions.<\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#ffdeed\"><strong>Related Read:&nbsp;<a href=\"https:\/\/www.foundit.sg\/career-advice\/front-end-developer-interview-questions-and-answers\/\" target=\"_blank\" rel=\"noreferrer noopener\">Front End Developer Interview Questions and Answers [ 2026 ]<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-promises-async-await\">8. Promises and Async\/Await<\/h2>\n\n\n\n<p>Promises and async\/await revolutionized asynchronous programming in JavaScript, replacing callback hell with cleaner, more manageable code structures.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">8.1 Promises<\/h3>\n\n\n\n<p>A Promise represents the eventual completion or failure of an asynchronous operation.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const promise = new Promise((resolve, reject) =&gt;  );\n\npromise\n  .then(result =&gt; console.log(result))\n  .catch(error =&gt; console.error(error));\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8.2 Async\/Await<\/h3>\n\n\n\n<p>Async functions allow you to write asynchronous code that looks synchronous using <code>await<\/code> inside an <code>async<\/code> function.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>async function fetchData()   catch (error)  \n}\nfetchData();\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8.3 Promise Chaining vs Async\/Await<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Promise chaining<\/strong> is better when handling multiple independent asynchronous tasks.<\/li>\n\n\n\n<li><strong>Async\/Await<\/strong> shines when tasks depend sequentially on previous results.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Pro Tip:<\/h3>\n\n\n\n<p>In interviews, be prepared to explain how Promises work internally, the three states (pending, fulfilled, rejected), and how <code>await<\/code> pauses execution without blocking the thread.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Common Mistake:<\/h3>\n\n\n\n<p>Forgetting to wrap <code>await<\/code> calls inside a <code>try\/catch<\/code> block can cause unhandled promise rejections.<\/p>\n\n\n\n<p>&#8212;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-classes-inheritance\">9. Classes and Inheritance<\/h2>\n\n\n\n<p>ES6 classes provide a cleaner syntax for creating constructor functions and handling inheritance. Although classes are syntactic sugar over JavaScript\u2019s prototype system, they make code more readable and object-oriented. <\/p>\n\n\n\n<p>Classes and inheritance were introduced to JavaScript with ES6 to bring better structure to code. Understanding these concepts is important in technical interviews. These topics are closely related to concepts seen in <a href=\"https:\/\/www.foundit.sg\/career-advice\/40-frequently-asked-advanced-java-interview-questions\/\" target=\"_blank\" rel=\"noopener\" title=\"\"><strong>advance Java interview questions and answers<\/strong>.<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">9.1 Defining a Class<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>class Person  \n  greet()  !`;\n  }\n}\nconst person1 = new Person(\"Alice\");\nconsole.log(person1.greet());\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9.2 Inheritance with extends<\/h3>\n\n\n\n<p>Subclasses are created using the <code>extends<\/code> keyword, allowing child classes to inherit and override methods from parent classes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Animal  \n  speak()   makes a noise.`);\n  }\n}\n\nclass Dog extends Animal   barks.`);\n  }\n}\n\nconst dog = new Dog(\"Buddy\");\ndog.speak(); \/\/ Buddy barks.\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9.3 The super Keyword<\/h3>\n\n\n\n<p><code>super()<\/code> is used to call the constructor or methods of the parent class inside a subclass.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Cat extends Animal  \n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Pro Tip:<\/h3>\n\n\n\n<p>Interviewers love to ask about how inheritance works under the hood \u2014 be ready to explain the prototype chain even when using class syntax.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Common Mistake:<\/h3>\n\n\n\n<p>Forgetting to call <code>super()<\/code> inside the subclass constructor before using <code>this<\/code> causes a ReferenceError.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Car extends Vehicle  \n}\n<\/code><\/pre>\n\n\n\n<p class=\"has-background\" style=\"background-color:#ffdeed\"><strong>Related Read:&nbsp;<a href=\"https:\/\/www.foundit.sg\/career-advice\/full-stack-developer-skills-you-can-add-in-your-resume\/\" target=\"_blank\" rel=\"noreferrer noopener\">Full Stack Developer Skills You Can Add to Your Resume<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-modules-import-export\">10. Modules: import and export<\/h2>\n\n\n\n<p>Before ES6, JavaScript lacked a native module system. Developers relied on external solutions like CommonJS and AMD. ES6 modules finally introduced a standardized way to organize code into reusable pieces, improving code maintainability and scalability.<\/p>\n\n\n\n<p>Developers interviewing for <a href=\"https:\/\/www.foundit.sg\/search\/java-jobs\" target=\"_blank\" rel=\"noopener\" title=\"Java Jobs\"><strong>Java jobs<\/strong> <\/a>will likely be asked about modules, especially when working with modern JavaScript applications. Familiarity with ES6 modules is essential, and if you\u2019re interested in <strong><a href=\"https:\/\/www.foundit.sg\/search\/java-developer-work-from-home-jobs\" target=\"_blank\" rel=\"noopener\" title=\"work-from-home Java developer jobs\">work-from-home Java developer jobs<\/a><\/strong>, it\u2019s even more crucial regarding collaboration and module sharing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">10.1 Exporting<\/h3>\n\n\n\n<p>You can export functions, objects, or primitives from a module using either named or default exports.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ utils.js\nexport const add = (a, b) =&gt; a + b;\nexport const subtract = (a, b) =&gt; a - b;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10.2 Importing<\/h3>\n\n\n\n<p>Import code from other modules to reuse across different files.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import   from '.\/utils.js';\nimport greet from '.\/greet.js'; \/\/ For default exports\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Pro Tip:<\/h3>\n\n\n\n<p>Use named exports when exporting multiple things from a module; use default exports when the module only exports one main thing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Common Mistake:<\/h3>\n\n\n\n<p>Mixing up named and default imports \u2014 named exports must be imported with the same names, default exports can have any name.<\/p>\n\n\n\n<p>&#8212;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-other-important-es6-features\">11. Other Important ES6+ Features<\/h2>\n\n\n\n<p>From <strong>Symbols<\/strong> to <strong>Maps and Sets<\/strong>, there are other ES6+ features that every modern JavaScript developer should understand. These features often come up in <strong><a href=\"https:\/\/www.foundit.sg\/career-advice\/programming-interview-questions\/\" target=\"_blank\" rel=\"noopener\" title=\"\">programming interview questions<\/a><\/strong> for advanced Java roles. You can also explore the <strong><a href=\"https:\/\/www.foundit.sg\/career-advice\/programming-languages-to-learn-today\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Top Programming Languages to Learn in 2026<\/a><\/strong> for a deeper understanding of how JavaScript compares to other languages in the modern tech stack.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">11.1 Symbol<\/h3>\n\n\n\n<p>Symbols are unique, immutable data types often used to create unique object property keys.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const sym1 = Symbol('description');\nconst sym2 = Symbol('description');\nconsole.log(sym1 === sym2); \/\/ false\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">11.2 Sets and Maps<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Set<\/strong>: A collection of unique values.<\/li>\n\n\n\n<li><strong>Map<\/strong>: A collection of key-value pairs, with any data type as keys.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>const set = new Set(&#091;1, 2, 3, 2]);\nconsole.log(set); \/\/  \n\nconst map = new Map();\nmap.set('name', 'Alice');\nconsole.log(map.get('name')); \/\/ Alice\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">11.3 Optional Chaining (?.)<\/h3>\n\n\n\n<p>Safely access deeply nested properties without worrying about undefined values.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const user =   };\nconsole.log(user?.profile?.email); \/\/ test@example.com\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">11.4 Nullish Coalescing (??)<\/h3>\n\n\n\n<p>Provide a fallback only for <code>null<\/code> or <code>undefined<\/code> values.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const name = null ?? \"Guest\";\nconsole.log(name); \/\/ Guest\n<\/code><\/pre>\n\n\n\n<p>&#8212;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-emerging-features-es2020-2025\">12. Bonus: Emerging Features from ES2020\u20132026<\/h2>\n\n\n\n<p>As JavaScript continues to evolve, staying updated with the latest features will make you a valuable asset in any development team.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">12.1 Dynamic Imports<\/h3>\n\n\n\n<p>Load JavaScript modules dynamically and on-demand.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import('.\/module.js').then(module =&gt;  );\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">12.2 Promise.allSettled()<\/h3>\n\n\n\n<p>Wait for all promises to either resolve or reject without short-circuiting.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Promise.allSettled(&#091;\n  Promise.resolve(1),\n  Promise.reject('Error')\n]).then(results =&gt; console.log(results));\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">12.3 Private Class Fields (#)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>class Person  \n}\nconst p = new Person();\nconsole.log(p.getAge()); \/\/ 30\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">12.4 Top-Level Await<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>const response = await fetch('\/api\/data');\nconst data = await response.json();\nconsole.log(data);\n<\/code><\/pre>\n\n\n\n<p class=\"has-background\" style=\"background-color:#ffdeed\"><strong>Pro Tip:<\/strong><br>Learning Top-Level Await, Private Fields, and Dynamic Imports will give you an edge during senior-level interviews.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Mastering JavaScript ES6+ features is a must for any developer aiming to stand out in interviews and real-world projects. Whether you are managing asynchronous code, structuring clean objects, or utilizing modern syntax like optional chaining, being confident with these tools will make you a stronger and more efficient developer. Stay curious, keep practicing, and embrace modern JavaScript!<\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#fffdeeed\">                                                       <strong>\ud83d\udc49 Ready to test your skills? <\/strong><br>Check <a href=\"http:\/\/your-link-to-Top-100-JavaScript-Interview-Questions\" target=\"_blank\" rel=\"noopener\" title=\"Javascript Interview Questions\"><strong>Top 100 JavaScript Interview Questions and Answers (2026)<\/strong><\/a> and boost your preparation today!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions (FAQ)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. What are the top JavaScript ES6 features for interviews?<\/h3>\n\n\n\n<p>The most important ES6 features for interviews include arrow functions, let\/const, promises, destructuring assignment, classes, modules (import\/export), and template literals.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. How important are Promises and Async\/Await for JavaScript interviews?<\/h3>\n\n\n\n<p>Very important! Asynchronous programming concepts like Promises and Async\/Await are heavily tested, especially for backend or full-stack JavaScript roles.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. What is the difference between var, let, and const?<\/h3>\n\n\n\n<p><code>var<\/code> is function-scoped and hoisted with undefined initialization. <code>let<\/code> and <code>const<\/code> are block-scoped, and <code>const<\/code> must be initialized and cannot be reassigned.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Why use optional chaining in JavaScript?<\/h3>\n\n\n\n<p>Optional chaining allows you to safely access nested object properties without throwing errors if a property is undefined. It improves code safety and readability.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Is learning ES2020+ features important for interviews?<\/h3>\n\n\n\n<p>Yes! Modern companies love candidates who are up-to-date with emerging features like Top-Level Await, Promise.allSettled(), and Private Class Fields. It shows adaptability and advanced knowledge.<\/p>\n\n\n\n<div style=\"text-align: center;\">\n\n<a style=\"display: inline-block;background-color: #7900c6;color: #fff;text-align: center;padding: 5px 10px;text-decoration: none;font-size: 18px;border-radius: 4px;font-weight: bold; margin-bottom: 5px;\" href=\"https:\/\/www.foundit.sg\/search\/python-developer-jobs\" target=\"_blank\" rel=\"noopener\">Python Developer Jobs<\/a>\n\n<a style=\"display: inline-block;background-color: #7900c6;color: #fff;text-align: center;padding: 5px 10px;text-decoration: none;font-size: 18px;border-radius: 4px;font-weight: bold; margin-bottom: 5px;\" href=\"https:\/\/www.foundit.sg\/search\/java-developer-jobs\" target=\"_blank\" rel=\"noopener\">Java Developer Jobs<\/a>\n\n\n<a style=\"display: inline-block;background-color: #7900c6;color: #fff;text-align: center;padding: 5px 10px;text-decoration: none;font-size: 18px;border-radius: 4px;font-weight: bold; margin-bottom: 5px;\" href=\"https:\/\/www.foundit.sg\/search\/front-end-developer-jobs\" target=\"_blank\" rel=\"noopener\">Front End Developer Jobs<\/a>\n\n<a style=\"display: inline-block;background-color: #7900c6;color: #fff;text-align: center;padding: 5px 10px;text-decoration: none;font-size: 18px;border-radius: 4px;font-weight: bold; margin-bottom: 5px;\" href=\"https:\/\/www.foundit.sg\/search\/backend-developer-jobs\" target=\"_blank\" rel=\"noopener\">Backend Developer Jobs<\/a>\n\n<a style=\"display: inline-block;background-color: #7900c6;color: #fff;text-align: center;padding: 5px 10px;text-decoration: none;font-size: 18px;border-radius: 4px;font-weight: bold; margin-bottom: 5px;\" href=\"https:\/\/www.foundit.sg\/search\/full-stack-developer-jobs\" target=\"_blank\" rel=\"noopener\">Full Stack Developer Jobs<\/a>\n\n<a style=\"display: inline-block;background-color: #7900c6;color: #fff;text-align: center;padding: 5px 10px;text-decoration: none;font-size: 18px;border-radius: 4px;font-weight: bold; margin-bottom: 5px;\" href=\"https:\/\/www.foundit.sg\/search\/software-developer-jobs\" target=\"_blank\" rel=\"noopener\">Software Developer Jobs<\/a>\n\n<a style=\"display: inline-block;background-color: #7900c6;color: #fff;text-align: center;padding: 5px 10px;text-decoration: none;font-size: 18px;border-radius: 4px;font-weight: bold; margin-bottom: 5px;\" href=\"https:\/\/www.foundit.sg\/search\/dot-net-developer-jobs\" target=\"_blank\" rel=\"noopener\">Dot Net Developer Jobs<\/a>\n\n\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>JavaScript\u2019s come a long way, and if you\u2019re aiming for a JavaScript developer job in Singapore, it\u2019s no longer enough to just &#8220;know the basics.&#8221;Whether you\u2019re applying to fast-paced tech startups at LaunchPad One-North or eyeing a role at big players like Shopee and Sea Group, understanding modern JavaScript ES6 features gives you a real [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":46676,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[147],"tags":[],"class_list":{"0":"post-46663","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-interview-questions"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.foundit.sg\/career-advice\/wp-json\/wp\/v2\/posts\/46663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.foundit.sg\/career-advice\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.foundit.sg\/career-advice\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.foundit.sg\/career-advice\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.foundit.sg\/career-advice\/wp-json\/wp\/v2\/comments?post=46663"}],"version-history":[{"count":7,"href":"https:\/\/www.foundit.sg\/career-advice\/wp-json\/wp\/v2\/posts\/46663\/revisions"}],"predecessor-version":[{"id":48398,"href":"https:\/\/www.foundit.sg\/career-advice\/wp-json\/wp\/v2\/posts\/46663\/revisions\/48398"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.foundit.sg\/career-advice\/wp-json\/wp\/v2\/media\/46676"}],"wp:attachment":[{"href":"https:\/\/www.foundit.sg\/career-advice\/wp-json\/wp\/v2\/media?parent=46663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.foundit.sg\/career-advice\/wp-json\/wp\/v2\/categories?post=46663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.foundit.sg\/career-advice\/wp-json\/wp\/v2\/tags?post=46663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}