Explore key concepts and features of asynchronous programming in…
Start QuizExplore underrated JavaScript libraries that offer powerful solutions for…
Start QuizExplore how pnpm 10 enhances package installation security and…
Start QuizExplore how JavaScript classes relate to prototypes, constructor functions,…
Start QuizDiscover the proven patterns and practical habits that distinguish…
Start QuizAssess your understanding of JavaScript modules, including import/export syntax,…
Start QuizChallenge your understanding of JavaScript function definitions, syntax, and…
Start QuizSharpen your understanding of JavaScript objects with these easy…
Start QuizExplore the basics of JavaScript loops with these straightforward…
Start QuizExplore easy questions covering fundamental JavaScript concepts, suitable for…
Start QuizExplore the basics of the JavaScript Event Loop, including…
Start QuizChallenge your JavaScript fundamentals with 15 essential interview questions…
Start QuizExplore essential concepts for handling dependencies across multi-package JavaScript…
Start QuizChallenge your understanding of fundamental JavaScript concepts with these…
Start QuizExplore the history and evolution of JavaScript, from its…
Start QuizEnhance your understanding of JavaScript with this beginner-friendly quiz…
Start QuizTest your understanding of common internet troubleshooting scenarios and…
Start QuizTest your knowledge of ES6 (ECMAScript 2015) features with…
Start QuizTest your understanding of key JavaScript topics with these…
Start QuizTest your knowledge with these commonly asked JavaScript interview…
Start QuizTest your knowledge of Observables in JavaScript, including their…
Start QuizTest your knowledge of essential JavaScript developer tips and…
Start QuizTest your knowledge of JavaScript ES6 features with this…
Start QuizTest your understanding of core JavaScript concepts relevant to…
Start QuizTest your expertise in JavaScript conditional statements, loops, and control flow interrupts with these challenging questions designed to assess nuanced understanding.
This quiz contains 16 questions. Below is a complete reference of all questions, answer choices, and correct answers. You can use this section to review after taking the interactive quiz above.
Given the code snippet: let x = 10; if (x > 5) { if (x < 15) { x++; } } else { x = 0; }, what will be the value of x after execution?
Correct answer: 11
In the statement if ('0' == 0), which principle is applied in JavaScript's conditional control flow?
Correct answer: Type coercion occurs and the condition is true
Given: let val = 2; switch(val) { case 1: val += 1; case 2: val += 2; break; case 3: val += 3; }, what is the value of val after executing the switch?
Correct answer: 4
What will be logged by: let output = ''; for(let i=0; i<5; i++) { if(i===3) break; output += i; } console.log(output);
Correct answer: 012
Which value will NOT be printed by the following? let i = 0; while(i < 5) { i++; if(i === 3) continue; console.log(i); }
Correct answer: 3
Consider let arr = ['a', 'b']; arr.extra = 'c'; Using for (let prop in arr), which values can prop take?
Correct answer: '0', '1', 'extra'
Given let arr = [1,,3]; using for (let num of arr), how many iterations will occur and what values will be assigned to num?
Correct answer: 2 iterations: 1 and 3
What happens if the default case in a switch statement is placed before the first case label?
Correct answer: It is valid and executes if no case matches
In the expression if (false && someFunction()), what is guaranteed about the execution of someFunction()?
Correct answer: It will not be called
Why does the following code log 5, 5, 5, 5, 5? for(var i=0; i<5; i++){ setTimeout(()=>console.log(i),0); }
Correct answer: Because 'var' shares function scope and i becomes 5 after the loop
Which statement best describes the difference between do...while and while loops in evaluating loop conditions?
Correct answer: do...while executes its body at least once regardless of condition
What is returned by: if (0 || (null && true)) { return 'A'; } else { return 'B'; }
Correct answer: 'B'
If a switch statement's case expressions are objects, under what circumstance will any case match?
Correct answer: Only if the same object reference is compared
What is the result of this code: let res = ''; for(let i=2,j=4; i<5&&j>1; i++,j--){ res += i+j; } return res;
Correct answer: '65'
How many times does Hello print in: let count=0; for(let i=0;i<3;i++){ for(let j=0;j<3;j++){ if(j==1) continue; count++; } } console.log('Hello'.repeat(count));
Correct answer: 6
Given let s = 'abc', what is the output of: let result = ''; for(let c of s){ result += c.toUpperCase(); } return result;
Correct answer: 'ABC'