550 Frontend Interview Questions (HTML, CSS and JavaScript) for 2027
You commented frontend, so here are all 550, free, with a link for each: 183 HTML questions and 212 CSS questions with written answers, plus 155 JavaScript "what's the output?" questions with explanations. They come from three GitHub repos, and every link jumps straight to its answer. I removed one CSS question its repo repeats.
The short version: most frontend rounds start with HTML and CSS, not React. Get the box model, Flexbox and Grid, and semantic HTML solid, then do the JavaScript output questions. Build the 3 small things below and you can talk through all of it.
The three repos
learning-zone/html-basics ~600 ★
github.com/learning-zone/html-basics
183 HTML interview questions with answers and code, from tags and forms to accessibility, SEO and web components.
learning-zone/css-basics ~780 ★
github.com/learning-zone/css-basics
212 CSS interview questions with answers, from the box model and specificity to Grid, animations and stacking contexts.
lydiahallie/javascript-questions ~65K ★
github.com/lydiahallie/javascript-questions
155 "what's the output?" JavaScript questions, each with the answer and an explanation of why. MIT licensed.
The 4 I'd start with
- Box model and specificity. Box model and selectors and specificity. Every CSS round starts here.
- Flexbox and Grid. Flexbox, CSS Grid and responsive design. Expect to build a layout live.
- Semantic HTML and accessibility. HTML tags, forms and accessibility. The section most candidates skip and interviewers notice.
- The JavaScript output questions. All 155 in Part 3. Read the code, guess the output, then read why.
What to build to prove you get it
- A responsive landing page using Grid for the layout and Flexbox inside each section, with no CSS framework.
- An accessible sign-up form with labels, error messages and full keyboard support.
- A CSS-only animation, like a loading spinner or a card flip, using transitions and transforms.
You don't need all 550. You need to centre a div five different ways and explain why each one works.
Jump to a topic
HTML: Introduction (26) · HTML Tags (17) · HTML Events (10) · HTML Forms (13) · HTML Tables (8) · HTML Lists (6) · HTML Iframe (4) · Html Url (7) · Html Svg (4) · HTML Canvas (1) · HTML Storage (6) · HTML APIs (6) · HTML Drag and Drop (3) · HTML Web Worker (5) · HTML Accessibility (6) · Miscellaneous (12) · HTML Media (4) · HTML5 Advanced APIs (6) · Service Workers & Web Workers (3) · IndexedDB & Advanced Web Storage (2) · Atomic Design & Pixel Perfect Design (2) · SEO Basics & Advanced (4) · HTML Performance Optimization (6) · HTML Tags & Elements (Intermediate) (14) · Web Components (4) · HTML Security (4)
CSS: Introduction (5) · Box Model (12) · Selectors & Specificity (8) · Positioning (5) · Flexbox (4) · CSS Grid (6) · Pseudo-Classes & Pseudo-Elements (12) · Transitions & Animations (9) · Transforms (8) · Media Queries & Responsive Design (19) · CSS Variables (10) · Typography & Text (15) · Colors & Gradients (15) · Z-index & Stacking Context (7) · Overflow & Clipping (10) · Display & Visibility (7) · Miscellaneous (51) · Technical Lead Role (9)
JavaScript output: Questions 1 to 31 (31) · Questions 32 to 62 (31) · Questions 63 to 93 (31) · Questions 94 to 124 (31) · Questions 125 to 155 (31)
Part 1: HTML interview questions (183)
Source: github.com/learning-zone/html-basics
Introduction (26)
- What is the difference between HTML and XHTML?
- What are the building blocks of HTML5?
- What are the semantic tags available in HTML5?
- Why you would like to use semantic tag?
- What does a <DOCTYPE html> do?
- What happens when DOCTYPE is not given?
- What is Character Encoding?
- What is the purpose of meta tags?
- What does async and defer refer in script tag?
- What does CORS stand for and what issue does it address?
- Can you describe the difference between progressive enhancement and graceful degradation?
- What is the DOM? How does the DOM work?
- How does the browser rendering engine work?
- What is the difference between standards mode and quirks mode?
- What is Critical Rendering Path?
- What are the Benefits of Server Side Rendering (SSR) Over Client Side Rendering (CSR)?
- What does the lang attribute in html do?
- Explain the difference between layout, painting and compositing?
- Explain about HTML Layout Engines used by browsers?
- Does the following trigger http request at the time of page load?
- What is progressive rendering?
- How do you serve a page with content in multiple languages?
- Discuss the differences between an HTML specification and a browser's implementation thereof.
- How do you establish and enforce HTML coding standards across a team?
- How do you implement HTML-level micro-frontend architecture?
- How do you implement browser feature detection and handle browser compatibility?
HTML Tags (17)
- What is difference between span tag and div tag?
- What are optional closing tag?
- What is a self closing tag?
- Explain the difference between block elements and inline elements?
- What are semantic and non-semantic elements?
- What is the purpose of main element?
- What are the semantic meanings for <section>, <article>, <aside>, <nav>, <header>, <footer> and how should each be used in structuring html markup?
- When should you use section, div or article?
- Can a web page contain multiple <header> elements? What about <footer> elements?
- What are the physical tags and logical tags in HTML?
- How can you highlight text in HTML?
- What is the difference between an "attribute" and a "property" in HTML?
- What is an optional tag?
- What is an HTML preprocessor? Have you used different HTML templating languages before?
- How do you change the direction of html text?
- When is it appropriate to use the small element?
- What is the difference between <section> and <div>?
HTML Events (10)
- What are HTML events?
- What are the categories of HTML events?
- What is event bubbling and event capturing in HTML?
- What is event delegation in HTML?
- What is the difference between event.preventDefault() and event.stopPropagation()?
- What is the difference between mouseenter and mouseover events?
- What is the difference between DOMContentLoaded and load events?
- What is the event object and what are its commonly used properties?
- What is the difference between focus and focusin, and blur and focusout events?
- What is the difference between input and change events on form elements?
HTML Forms (13)
- What is an HTML form and what is it used for?
- What are all the input types available in HTML?
- What is HTML form validation and what are the built-in validation attributes?
- What is the difference between name and id attributes on form elements?
- How does the <label> element improve HTML forms?
- What is the <fieldset> and <legend> element in HTML forms?
- What are the different button types in HTML forms?
- What is the autocomplete attribute in HTML forms?
- What are the new form elements in HTML5?
- How many new form elements are introduced in html5?
- Create a HTML form with below constraints?
- What does enctype='multipart/form-data' mean?
- What is difference between Select and Datalist?
HTML Tables (8)
- What are the basic HTML table elements and their purpose?
- What is the difference between <th> and <td> in HTML tables?
- How do colspan and rowspan attributes work in HTML tables?
- What is the <caption> element in HTML tables and why is it important?
- How do you use <colgroup> and <col> to style table columns?
- How do you create an accessible HTML table?
- How do you make an HTML table responsive?
- How do you style an HTML table with CSS?
HTML Lists (6)
- What are the types of lists available in HTML?
- What are the attributes of the <ol> element?
- How do you customize list markers with CSS?
- How do you create a nested list in HTML?
- What is a description list in HTML and when should you use it?
- How do you create a navigation menu using an HTML list?
HTML Iframe (4)
- What is an iframe and how it works?
- How does cross-origin communication work with iframes using postMessage?
- What are the performance considerations when using iframes?
- What is the allow attribute on iframes and how does it relate to Permissions Policy?
Html Url (7)
- What is a URL and what are its components?
- What is the difference between absolute and relative URLs?
- What is the <base> tag in HTML and how does it affect URLs?
- What is the difference between href and src attributes?
- What are the target attribute values for anchor tags?
- What is URL encoding and when is it required?
- Explain the use of rel="nofollow", rel="noreferrer", rel="noopener" attribute?
Html Svg (4)
- What is difference between SVG and Canvas?
- What are the different ways to embed SVG in HTML and when should you use each?
- How do you make SVG accessible?
- How do you animate SVG and what are the different animation techniques?
HTML Canvas (1)
HTML Storage (6)
- What is local storage in html5?
- What is session storage in html5?
- What is cookies in html5?
- Describe the difference between a cookie, sessionStorage and localStorage?
- Does localStorage throw error after reaches maximum limits?
- What is the purpose of cache busting and how can you achieve it?
HTML APIs (6)
- List the API available in HTML5?
- How geolocation api works in html5?
- What is the use of WebSocket API?
- What is the MutationObserver API and when should you use it?
- What is the ResizeObserver API and how is it different from the resize window event?
- What is requestAnimationFrame and why should you use it for animations?
HTML Drag and Drop (3)
- Explain Drag and Drop in HTML5?
- What is the DataTransfer object and how do you use it in drag and drop?
- How do you handle file drag and drop in HTML5?
HTML Web Worker (5)
- What is an HTML Web Worker and why is it needed?
- How do you create and communicate with a Web Worker?
- What are the types of Web Workers?
- What is the lifecycle of a Web Worker?
- What is the difference between a Web Worker and a Service Worker?
HTML Accessibility (6)
- What ARIA and screenreaders are, and how to make a website accessible?
- What is accessibility & ARIA role means in a web application?
- What is tabindex attribute and how does it affect keyboard navigation?
- What are skip navigation links and why are they important?
- What are ARIA live regions and when should you use them?
- How do you manage focus in Single Page Applications (SPAs)?
Miscellaneous (12)
- How to use data- attribute in html5?
- What is the purpose of the alt attribute on images?
- Explain some of the pros and cons for CSS animations versus JavaScript animations?
- How to improve the page load?
- How to improve website performance?
- What is desktop first and mobile first design approach?
- What are data- attributes good for?
- How to make page responsive?
- Explain Microdata in HTML5?
- How can I get indexed better by search engines?
- Why you would use a srcset attribute in an image tag?
- Create a traffic signal light in html?
HTML Media (4)
- How to use the HTML5 <video> element?
- How to use the HTML5 <audio> element?
- What is the <picture> element and how does it work?
- How to add subtitles and captions to an HTML5 video?
HTML5 Advanced APIs (6)
- What is the Server-Sent Events (SSE) API?
- What is the Intersection Observer API?
- What is the History API in HTML5?
- What is the Notification API?
- What is the File API in HTML5?
- What is MathML and how is it used in HTML5?
Service Workers & Web Workers (3)
- What is a Web Worker in HTML5?
- What is a Service Worker?
- What is the difference between Web Workers and Service Workers?
IndexedDB & Advanced Web Storage (2)
Atomic Design & Pixel Perfect Design (2)
SEO Basics & Advanced (4)
- What are Core Web Vitals?
- What is structured data and JSON-LD for SEO?
- What are hreflang tags and when should you use them?
- What is the difference between crawling and indexing in SEO?
HTML Performance Optimization (6)
- What are resource hints in HTML5?
- How to implement lazy loading in HTML?
- What is the difference between async and defer in <script> and when to use each?
- What is Content Security Policy (CSP) and how is it configured in HTML?
- What is the purpose of <link rel="preload"> and how does it improve performance?
- What are WCAG guidelines and accessibility levels?
HTML Tags & Elements (Intermediate) (14)
- What is the difference between <strong> and <b>, <em> and <i>?
- What are the <details> and <summary> elements?
- What are the <figure> and <figcaption> elements?
- What is the <time> element and why is it useful?
- What is the difference between the hidden attribute and display: none?
- What is the <base> element in HTML?
- What is the <dialog> element in HTML?
- What is the <noscript> element?
- What is the difference between src and href attributes?
- What is the difference between innerHTML, textContent, and innerText?
- What are HTML entities and when do you use them?
- What is the contenteditable attribute?
- What is HTML5 native form validation and what are constraint validation attributes?
- What is the difference between GET and POST methods in HTML forms?
Web Components (4)
- What is Shadow DOM and how does it work?
- What are Custom Elements in HTML5 (Web Components)?
- What is the <template> element in HTML?
- What is the <slot> element in Web Components?
HTML Security (4)
- What is Subresource Integrity (SRI) and how is it used?
- What is the sandbox attribute on <iframe> and how does it enhance security?
- How do you prevent Cross-Site Scripting (XSS) in HTML?
- What is Clickjacking and how do you prevent it in HTML?
Part 2: CSS interview questions (212)
Source: github.com/learning-zone/css-basics
Introduction (5)
- What is CSS?
- What is the use of css ruleset?
- What are the possible ways to apply CSS styles to a web page?
- What does the cascading portion of CSS mean?
- How does CSS work under the hood?
Box Model (12)
- Explain the CSS "box model" and the layout components that it consists of?
- What is the difference between box-sizing: content-box and box-sizing: border-box?
- What is margin collapsing in CSS?
- What is the difference between padding and margin?
- What is the Block Formatting Context (BFC) and how does it affect the box model?
- How does the outline differ from border in the CSS box model?
- How do you calculate the total width and height of an element?
- Does margin-top or margin-bottom have an effect on inline elements?
- How you would tell the browser in CSS to render your layout in different box models?
- What is the difference between border-box and content-box?
- What is the purpose of the box-sizing property?
- What does * { box-sizing: border-box; } do? What are its advantages?
Selectors & Specificity (8)
- What are the css selectors?
- What is contextual selector?
- What is the difference between Pseudo-classes and pseudo-elements?
- What is Combinator selector?
- What is the difference between class selectors and id selectors?
- What is the difference between the "nth-child()" and "nth-of-type()" selectors?
- What is specificity?
- In CSS3, how would you select?
Positioning (5)
- Explain CSS position Property?
- What are the differences between relative and absolute in CSS?
- What are the CSS positioning?
- What are all the ways to center an element horizontally and vertically in CSS?
- How does position: sticky work and what are its common pitfalls?
Flexbox (4)
- What is CSS flexbox?
- Write all the properties of the flexbox?
- What is the difference between flex-grow, flex-shrink, and flex-basis?
- What is the difference between align-items, align-content, align-self, and justify-content in Flexbox?
CSS Grid (6)
- Explain CSS grid layout with example?
- When to use css grid and flexbox?
- What is the difference between auto-fill and auto-fit in CSS Grid?
- What is CSS Subgrid and what problem does it solve?
- What is the gap property in CSS and how does it work in Flexbox and Grid?
- Explain the usage of "table-layout" property?
Pseudo-Classes & Pseudo-Elements (12)
- What is pseudo element and pseudo class?
- How does the ::before and ::after pseudo-element work?
- What is the :root pseudo-class and how is it different from the html selector?
- What is the :is() pseudo-class and how does it simplify selectors?
- What is the :where() pseudo-class and how does it differ from :is()?
- What is the :has() pseudo-class (the CSS parent selector)?
- What is the :not() pseudo-class?
- What are structural pseudo-classes and how do :nth-child() expressions work?
- What are UI state pseudo-classes used for form elements?
- What is the ::selection pseudo-element?
- What is the ::placeholder pseudo-element?
- What is the difference between :focus and :focus-visible?
Transitions & Animations (9)
- What do you know about CSS Transitions?
- What is the difference between transition and animation in CSS?
- What are CSS @keyframes and how do they work?
- What are the CSS animation properties?
- What is animation-fill-mode and what are its values?
- What is the transition-timing-function property and what values does it accept?
- How do you pause and resume a CSS animation using JavaScript?
- What is the will-change property and when should you use it?
- How do you create a CSS loading spinner animation?
Transforms (8)
- What is the CSS transform property and what are its common functions?
- What is transform-origin and how does it affect transformations?
- What is the difference between translate() and position offset for moving elements?
- What is the perspective property in CSS 3D transforms?
- What is transform-style and backface-visibility in CSS?
- How do CSS transforms affect stacking context and document flow?
- What is the matrix() transform function?
- How do you style and animate SVG elements with CSS?
Media Queries & Responsive Design (19)
- What are media queries? How could you apply css rules specific to a media?
- How a browser determines what elements match a CSS selector?
- How is responsive design different from adaptive design?
- What is the viewport meta tag and why is it important for responsive design?
- What is the difference between min-width and max-width in media queries?
- What are common responsive breakpoints used in CSS?
- How do you use media queries to target orientation (portrait vs. landscape)?
- How do you create a responsive navigation menu with CSS media queries?
- What are the and, not, and only operators in media queries?
- What is the @media (prefers-color-scheme) feature and how do you use it?
- What is the @media (prefers-reduced-motion) feature?
- What is the @media (hover) and @media (pointer) feature?
- What is the @media print query and how do you optimise a page for printing?
- What are fluid images and how do you implement them in responsive design?
- What are CSS container queries and how are they different from media queries?
- What is the clamp() function and how does it help with responsive typography?
- What are the CSS units vw, vh, vmin, and vmax?
- What is mobile-first design and why is it recommended?
- What are CSS frameworks and how do component-based and utility-first frameworks differ?
CSS Variables (10)
- What do CSS Custom properties variables mean?
- What is the difference between CSS variables and preprocessor(SASS, LESS, Stylus) variables?
- How do you define and use CSS custom properties (variables)?
- What is the scope of CSS custom properties?
- How do CSS custom properties enable dynamic theming?
- What is the var() fallback and how does it work?
- Can CSS custom properties be used inside calc()?
- How do CSS custom properties work with media queries for responsive design?
- What are the limitations of CSS custom properties?
- How do you use CSS custom properties for a design token system?
Typography & Text (15)
- What is the difference between serif and sans-serif fonts?
- What is the difference between em and rem units in typography?
- What are web-safe fonts?
- How do you use Google Fonts (or custom fonts) with @font-face?
- What is line-height and how does it affect text?
- What are the font-weight values and what do they mean?
- What is text-transform and what values does it support?
- What is the difference between text-align values: left, right, center, and justify?
- What is letter-spacing and word-spacing?
- What is the text-decoration property?
- What is text-overflow and how does it work?
- What is white-space property in CSS?
- What is word-break and overflow-wrap in CSS?
- What is the font shorthand property?
- What is variable font and how is it used in CSS?
Colors & Gradients (15)
- What are gradients in CSS?
- What are the different ways to specify colors in CSS?
- What is the difference between rgb() and hsl() color models?
- What is currentColor in CSS?
- What is the difference between linear-gradient() and radial-gradient()?
- What is conic-gradient() in CSS?
- What are repeating gradients in CSS?
- What is opacity in CSS and how does it differ from rgba() transparency?
- What is the CSS color-mix() function?
- How do you create a multi-color gradient with specific color stops?
- What is the difference between RGBa, HEX and HSLa?
- What is object-fit and object-position in CSS?
- What is the aspect-ratio property and why is it important?
- What is backdrop-filter and how does it differ from filter?
- What is mix-blend-mode in CSS and when would you use it?
Z-index & Stacking Context (7)
- What is the purpose of the z-index and how a stacking context is formed?
- What is a stacking context in CSS and how is it created?
- What is the difference between z-index: 0 and z-index: auto?
- How does z-index work with non-positioned elements?
- What CSS properties trigger a new stacking context without using z-index?
- How do you use isolation: isolate to control stacking?
- How do you debug z-index issues in CSS?
Overflow & Clipping (10)
- What is the overflow property in CSS used for?
- What is word-wrapping in CSS?
- What is the difference between overflow: scroll and overflow: auto?
- How do overflow-x and overflow-y work independently?
- How does overflow: hidden create a Block Formatting Context (BFC)?
- How do you create a single-line text truncation with an ellipsis?
- What is overflow: clip and how does it differ from overflow: hidden?
- What is clip-path in CSS and how is it used for clipping elements?
- How does overflow behave with absolutely positioned elements?
- What is CSS masking and how does it differ from clip-path?
Display & Visibility (7)
- What are the different ways to visually hide content (and make it available only for screen readers)?
- What is CSS BEM?
- What is tweening in css?
- Explain the difference between visibility: hidden; and display: none;? What are the pros and cons of using display:none?
- The difference between block, inline and inline-block element?
- What is CSS opacity?
- What is display: contents and what does it do?
Miscellaneous (51)
- What are counters in CSS3?
- How do you specify units in the CSS?
- Which one would you prefer among px, em % or pt and why?
- Explain the meaning of each of these CSS units for expressing length?
- What is CSS preprocessor?
- What is the difference between "resetting" and "normalizing" CSS?
- Explain CSS Block Formatting Context?
- What is the float property and what float do?
- Describe clear Property in css?
- Explain the purpose of clearing floats in CSS?
- What is a clearfix in CSS?
- Does overflow: hidden create a new block formatting context?
- How can you load css resources conditionally?
- List display property in CSS?
- What is retina graphics? What kind of techniques do you use to handle images for retina screens?
- Is there any reason you'd want to use translate() instead of absolute positioning, or vice-versa?
- Tell what each of these tags do, if there are alternatives, which are preferable, why?
- What is At-Rule?
- How can the gap under the image be removed?
- What is progressive rendering?
- What is mobile-first? Can you explain the difference between coding a website to be responsive versus using a mobile-first strategy?
- What are the different css filters you can use?
- Enlist the various fonts properties?
- Enlist the various background properties css?
- What is the difference between em and rem units?
- What does !important mean in CSS?
- Does style2.css have to be downloaded and parsed before Paragraph 1 is rendered on the page?
- Does style1.css have to be downloaded and parsed before style2.css can be fetched?
- How is the concept of inheritance applied in CSS?
- What are the CSS-wide value keywords inherit, initial, unset, and revert?
- How do you handle browser differences in your user base?
- What is Cascade?
- What is DOM (Document Object Model) and how is it linked to CSS?
- How does Calc() work?
- What are Vendor-Prefixes?
- What is the property that is used for controlling image-scroll?
- What is Accessibility (a11y) in a web application?
- What is UI/UX?
- How do you serve your pages for feature-constrained browsers? What techniques do you use?
- What is file splitting? When is it used?
- What is DOM reflow?
- What is CSS-in-JS and what are its advantages and disadvantages?
- What is PostCSS and how does it differ from CSS preprocessors like Sass?
- What is lazy loading and how is it applied in CSS contexts?
- What is critical CSS and why is it important for performance?
- What is CSS scroll-snap and how do you implement it?
- What is the pointer-events property in CSS?
- What is the CSS @layer rule and why is it useful?
- What are CSS Logical Properties and why are they important?
- What is content-visibility and how does it improve CSS rendering performance?
- How do you calculate CSS specificity with a worked example?
Technical Lead Role (9)
- How do you establish and enforce CSS coding standards across a team?
- How do you manage CSS architecture for large-scale projects?
- How do you conduct effective CSS code reviews?
- How do you handle CSS performance optimization as a tech lead?
- How do you manage cross-browser CSS compatibility in a team?
- How do you define a CSS testing strategy?
- How do you mentor junior developers on CSS best practices?
- How do you communicate CSS technical debt to non-technical stakeholders?
- How do you design and maintain a CSS design system for a team?
Part 3: JavaScript "what's the output?" questions (155)
Source: github.com/lydiahallie/javascript-questions
Questions 1 to 31 (31)
- Q1: What's the output?: function sayHi() {
- Q2: What's the output?: for (var i = 0; i < 3; i++) {
- Q3: What's the output?: const shape = {
- Q4: What's the output?: +true;
- Q5: Which one is true?: const bird = {
- Q6: What's the output?: let c = { greeting: 'Hey!' };
- Q7: What's the output?: let a = 3;
- Q8: What's the output?: class Chameleon {
- Q9: What's the output?: let greeting;
- Q10: What happens when we do this?: function bark() {
- Q11: What's the output?: function Person(firstName, lastName) {
- Q12: What's the output?: function Person(firstName, lastName) {
- Q13: What are the three phases of event propagation?: - A: Target > Capturing > Bubbling
- Q14: All object have prototypes.: - A: true
- Q15: What's the output?: function sum(a, b) {
- Q16: What's the output?: let number = 0;
- Q17: What's the output?: function getPersonInfo(one, two, three) {
- Q18: What's the output?: function checkAge(data) {
- Q19: What's the output?: function getAge(...args) {
- Q20: What's the output?: function getAge() {
- Q21: What's the value of sum?: const sum = eval('10*10+5');
- Q22: How long is cool_secret accessible?: sessionStorage.setItem('cool_secret', 123);
- Q23: What's the output?: var num = 8;
- Q24: What's the output?: const obj = { 1: 'a', 2: 'b', 3: 'c' };
- Q25: What's the output?: const obj = { a: 'one', b: 'two', a: 'three' };
- Q26: The JavaScript global execution context creates two things for you: the global object, and the "this" keyword.: - A: true
- Q27: What's the output?: for (let i = 1; i < 5; i++) {
- Q28: What's the output?: String.prototype.giveLydiaPizza = () => {
- Q29: What's the output?: const a = {};
- Q30: What's the output?: const foo = () => console.log('First');
- Q31: What is the event.target when clicking the button?: Click!
Questions 32 to 62 (31)
- Q32: When you click the paragraph, what's the logged output?: Click here!
- Q33: What's the output?: const person = { name: 'Lydia' };
- Q34: What's the output?: function sayHi() {
- Q35: Which of these values are falsy?: 0;
- Q36: What's the output?: console.log(typeof typeof 1);
- Q37: What's the output?: const numbers = [1, 2, 3];
- Q38: What's the output?: (() => {
- Q39: Everything in JavaScript is either a...: - A: primitive or object
- Q40: What's the output?: [[0, 1], [2, 3]].reduce(
- Q41: What's the output?: !!null;
- Q42: What does the setInterval method return in the browser?: setInterval(() => console.log('Hi'), 1000);
- Q43: What does this return?: [...'Lydia'];
- Q44: What's the output?: function* generator(i) {
- Q45: What does this return?: const firstPromise = new Promise((res, rej) => {
- Q46: What's the output?: let person = { name: 'Lydia' };
- Q47: What's the output?: const person = {
- Q48: What's the output?: console.log(3 + 4 + '5');
- Q49: What's the value of num?: const num = parseInt('7*6', 10);
- Q50: What's the output?: [1, 2, 3].map(num => {
- Q51: What's the output?: function getInfo(member, year) {
- Q52: What's the output?: function greeting() {
- Q53: What's the output?: function Car() {
- Q54: What's the output?: (() => {
- Q55: What's the output?: class Dog {
- Q56: What's the output?: const set = new Set([1, 1, 2, 3, 4]);
- Q57: What's the output?: // counter.js
- Q58: What's the output?: const name = 'Lydia';
- Q59: What's the output?: const numbers = [1, 2, 3, 4, 5];
- Q60: What's the output?: const user = { name: 'Lydia', age: 21 };
- Q61: What's the output?: const person = { name: 'Lydia' };
- Q62: What's the output?: const settings = {
Questions 63 to 93 (31)
- Q63: What's the output?: let num = 10;
- Q64: What's the output?: const value = { number: 10 };
- Q65: What's the output?: [1, 2, 3, 4].reduce((x, y) => console.log(x, y));
- Q66: With which constructor can we successfully extend the Dog class?: class Dog {
- Q67: What's the output?: // index.js
- Q68: What's the output?: console.log(Number(2) === Number(2));
- Q69: What's the output?: const name = 'Lydia Hallie';
- Q70: What's the output?: console.log('🥑' + '💻');
- Q71: How can we log the values that are commented out after the console.log statement?: function* startGame() {
- Q72: What's the output?: console.log(String.raw`Hello\nworld`);
- Q73: What's the output?: async function getData() {
- Q74: What's the output?: function addToList(item, list) {
- Q75: What's the output?: const box = { x: 10, y: 20 };
- Q76: What's the output?: const { firstName: myName } = { firstName: 'Lydia' };
- Q77: Is this a pure function?: function sum(a, b) {
- Q78: What is the output?: const add = () => {
- Q79: What is the output?: const myLifeSummedUp = ['☕', '💻', '🍷', '🍫'];
- Q80: What is the output?: const list = [1 + 2, 1 * 2, 1 / 2];
- Q81: What is the output?: function sayHi(name) {
- Q82: What is the output?: var status = '😎';
- Q83: What is the output?: const person = {
- Q84: What is the output?: function checkAge(age) {
- Q85: What kind of information would get logged?: fetch('https://www.website.com/api/user/1')
- Q86: Which option is a way to set hasName equal to true, provided you cannot pass true as an argument?: function getName(name) {
- Q87: What's the output?: console.log('I want pizza'[0]);
- Q88: What's the output?: function sum(num1, num2 = num1) {
- Q89: What's the output?: // module.js
- Q90: What's the output?: class Person {
- Q91: What's the output?: let newList = [1, 2, 3].push(4);
- Q92: What's the output?: function giveLydiaPizza() {
- Q93: What's the output?: const person = {
Questions 94 to 124 (31)
- Q94: What's the output?: function getItems(fruitList, ...args, favoriteFruit) {
- Q95: What's the output?: function nums(a, b) {
- Q96: What's the output?: class Person {
- Q97: What's the output?: const info = {
- Q98: What's the output?: const getList = ([x, ...y]) => [x, y]
- Q99: What's the output?: const name = 'Lydia';
- Q100: What's the value of output?: // 🎉✨ This is my 100th question! ✨🎉
- Q101: What's the value of output?: const one = false || {} || null;
- Q102: What's the value of output?: const myPromise = () => Promise.resolve('I have resolved!');
- Q103: What's the value of output?: const set = new Set();
- Q104: What's its value?: Promise.resolve(5);
- Q105: What's its value?: function compareMembers(person1, person2 = person) {
- Q106: What's its value?: const colorConfig = {
- Q107: What's its value?: console.log('❤️' === '❤️');
- Q108: Which of these methods modifies the original array?: const emojis = ['✨', '🥑', '😍'];
- Q109: What's the output?: const food = ['🍕', '🍫', '🥑', '🍔'];
- Q110: What does this method do?: JSON.parse();
- Q111: What's the output?: let name = 'Lydia';
- Q112: What's the output?: function* generatorOne() {
- Q113: What's the output?: console.log(`${(x => x)('I love')} to program`);
- Q114: What will happen?: let config = {
- Q115: Which method(s) will return the value 'Hello world!'?: const myMap = new Map();
- Q116: What's the output?: const person = {
- Q117: Which of the following options will return 6?: function sumValues(x, y, z) {
- Q118: What's the output?: let num = 1;
- Q119: What's the output?: const person = {
- Q120: What's the output?: const groceries = ['banana', 'apple', 'peanuts'];
- Q121: What's the output?: const config = {
- Q122: What's the output?: const name = 'Lydia Hallie';
- Q123: What's the output?: const add = x => y => z => {
- Q124: What's the output?: async function* range(start, end) {
Questions 125 to 155 (31)
- Q125: What's the output?: const myFunc = ({ x, y, z }) => {
- Q126: What's the output?: function getFine(speed, amount) {
- Q127: What's the output?: const spookyItems = ['👻', '🎃', '🕸'];
- Q128: What's the output?: const name = 'Lydia Hallie';
- Q129: What's the output?: const randomValue = 21;
- Q130: What's the output?: const myPromise = Promise.resolve('Woah some cool data');
- Q131: What's the output?: const emojis = ['🥑', ['✨', '✨', ['🍕', '🍕']]];
- Q132: What's the output?: class Counter {
- Q133: What's the output?: const myPromise = Promise.resolve(Promise.resolve('Promise')
- Q134: How can we invoke sum in sum.js from index.js?: // sum.js
- Q135: What's the output?: const handler = {
- Q136: Which of the following will modify the person object?: const person = { name: 'Lydia Hallie' };
- Q137: Which of the following will modify the person object?: const person = {
- Q138: What's the output?: const add = x => x + x;
- Q139: What's the output?: class Counter {
- Q140: What's missing?: const teams = [
- Q141: What's the output?: const person = {
- Q142: What's the output?: class Bird {
- Q143: Which of the options result(s) in an error?: const emojis = ['🎄', '🎅🏼', '🎁', '⭐'];
- Q144: What do we need to add to the person object to get ["Lydia Hallie", 21] as the output of [...person]?: const person = {
- Q145: What's the output?: let count = 0;
- Q146: What's the output?: function getFruit(fruits) {
- Q147: What's the output?: class Calc {
- Q148: What's the output?: const user = {
- Q149: What's the output?: const fruit = ['🍌', '🍊', '🍎']
- Q150: What's the output?: const animals = {};
- Q151: What's the output?: const user = {
- Q152: What's the output?: const promise1 = Promise.resolve('First')
- Q153: What should the value of method be to log { name: "Lydia", age: 22 }?: const keys = ["name", "age"]
- Q154: What's the output?: const createMember = ({ email, address = {}}) => {
- Q155: What's the output?: let randomValue = { name: "Lydia" }
How I'd use this
- Answer out loud before you open the answer. Frontend interviews test how you explain, not what you recognise.
- Open DevTools while you revise CSS. Change a property, watch what happens, and you'll remember it.
- Do 10 JavaScript output questions a day. Write down why for every one you get wrong.
- Build the 3 things above, deploy them, and put the links on your resume.
Next: 518 JavaScript interview questions and 446 React interview questions.
Follow @avi_vashishta29 for one practical AI dev resource a day.