Unlock hundreds more features
Save your Quiz to the Dashboard
View and Export Results
Use AI to Create Quizzes and Analyse Results

Sign inSign in with Facebook
Sign inSign in with Google

Test Your JavaScript Knowledge Assessment Quiz

Improve Your JavaScript Skills with Quick Quiz

Difficulty: Moderate
Questions: 20
Learning OutcomesStudy Material
Colorful paper art depicting a JavaScript Knowledge Assessment Quiz

Dive into this JavaScript Knowledge Assessment Quiz to discover how well you understand key scripting concepts. Featuring 15 multiple-choice questions, it's ideal for students, educators, and developers seeking a quick skill check. Explore ES6 syntax and async patterns with the JavaScript Fundamentals Quiz or broaden your review through the Knowledge Assessment Quiz. You can freely modify any question in our quizzes editor to suit your learning needs. Start now to sharpen your coding proficiency with an engaging, interactive challenge.

Which keyword declares a variable that cannot be reassigned?
let
static
const
var
The const keyword declares a block-scoped variable whose value cannot be reassigned. var and let allow reassignment, and static is not used for standard variable declarations.
Which Array method adds a new element to the end of the array?
unshift()
shift()
pop()
push()
The push() method appends one or more elements to the end of an array. pop() removes the last element, shift() removes the first, and unshift() adds to the front.
What does typeof null return in JavaScript?
"null"
"boolean"
"object"
"undefined"
Due to legacy reasons, typeof null returns "object" even though null is a primitive. This is a well-known quirk of JavaScript.
Which symbol is used to define a template literal in ES6?
Backticks (`)
Single quotes (')
Dollar sign ($)
Double quotes (")
Template literals are defined using backticks (`). They allow embedded expressions with ${...} and support multi-line strings.
What does the strict equality operator (===) check?
Only type equality
Inequality of value or type
Only value equality, converting types if needed
Value equality and type equality without conversion
The === operator checks both value and type for equality without performing type conversion. This prevents unexpected true comparisons that occur with ==.
What is the output of the following code? console.log(a); var a = 5;
ReferenceError
5
null
 
Variable declarations using var are hoisted to the top and initialized with undefined. The assignment of 5 happens after the log, so it prints undefined.
Which keyword declares a block-scoped variable in JavaScript?
let
global
var
function
The let keyword declares a block-scoped variable that is limited to the block in which it is defined. var is function-scoped, not block-scoped.
What value does the following function return when called? function outer() { let x = 10; function inner() { return x + 5; } return inner(); } console.log(outer());
15
10
NaN
5
The inner function forms a closure over x (which is 10) and returns x + 5, resulting in 15 when outer() is called.
Arrow functions differ from traditional functions because they do NOT have their own...
reference to outer variables
this binding
arguments object
both this binding and arguments object
Arrow functions inherit this from their lexical scope and do not have their own arguments object. They use the surrounding context for both
Which of the following creates a Promise that resolves after 1 second?
setTimeout(Promise.resolve, 1000)
new Promise((resolve, reject) => reject())
new Promise((resolve) => setTimeout(resolve, 1000))
Promise.resolve(setTimeout(() => {}, 1000))
new Promise((resolve) => setTimeout(resolve, 1000)) constructs a promise and calls resolve after one second, causing it to resolve at that time.
Which method is used to handle errors in a promise chain?
.all()
.then()
.catch()
.finally()
.catch() is specifically designed to handle promise rejections in a chain. .then() handles fulfillment, .finally() runs regardless of outcome, and .all() combines promises.
How do you pause execution inside an async function until a promise resolves?
block
yield
await
timeout
The await keyword can only be used inside async functions to pause execution until the promise provided resolves.
Which ES6 feature allows you to extract properties from an object into variables?
Default parameters
Template literals
Spread operator
Destructuring
Object destructuring uses syntax like const {a, b} = obj to extract properties into local variables in a concise way.
Which technique can improve performance when appending many elements to the DOM?
Appending to the live DOM directly
Cloning document.body repeatedly
Using innerHTML in each iteration
Using DocumentFragment
DocumentFragment allows you to build a sub-tree off-DOM and append it once, reducing reflow and repaint operations for better performance.
What is the term for attaching a single event listener on a parent to manage child element events?
Event bubbling
Event delegation
Event capturing
Event throttling
Event delegation leverages event bubbling so a single listener on a parent can handle events for multiple child elements efficiently.
What is the output of the following code? function makeAdder(x) { return function(y) { return x + y; }; } const add5 = makeAdder(5); console.log(add5(2));
NaN
7
 
52
makeAdder returns a closure that captures x=5. Calling add5(2) adds 5 + 2, resulting in 7.
What is the order of console output? async function test() { console.log('A'); await Promise.resolve(); console.log('B'); } console.log('C'); test(); console.log('D');
A, C, D, B
C, A, D, B
A, B, C, D
C, A, B, D
test() logs 'A' synchronously, then awaits and yields. The host logs 'C', then 'A', then 'D', followed by the queued 'B' in the microtask queue.
What is logged by this code? const obj = { count: 0, inc: function() { setTimeout(function() { this.count++; console.log(this.count); }, 100); } }; obj.inc();
1
 
NaN
0
The callback in setTimeout uses its own this (global object), where count is undefined. undefined++ yields NaN, so NaN is logged.
What happens when one promise in Promise.all rejects?
Promise.all rejects with the first rejection reason
Promise.all resolves with all results
Promise.all waits for all to settle then returns outcomes
Promise.all resolves with an array of undefined for rejections
Promise.all rejects immediately upon the first encountered rejection, returning that rejection reason rather than waiting for other promises.
What is the output of this code? console.log('1'); setTimeout(() => console.log('2'), 0); Promise.resolve().then(() => console.log('3')); console.log('4');
1, 3, 4, 2
1, 4, 3, 2
1, 4, 2, 3
1, 2, 3, 4
Synchronous logs run first (1, 4), then microtasks (Promise.then) print 3, and finally the macrotask from setTimeout prints 2.
0
{"name":"Which keyword declares a variable that cannot be reassigned?", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Which keyword declares a variable that cannot be reassigned?, Which Array method adds a new element to the end of the array?, What does typeof null return in JavaScript?","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}

Learning Outcomes

  1. Analyse JavaScript syntax and structure to debug code effectively.
  2. Identify core JS concepts like hoisting, closures, and scope.
  3. Apply ES6 features such as arrow functions and template literals.
  4. Demonstrate understanding of asynchronous programming with promises.
  5. Evaluate performance considerations in DOM manipulation tasks.
  6. Master event handling and callback functions for dynamic apps.

Cheat Sheet

  1. Understand JavaScript Syntax and Structure - JavaScript is like a magic spellbook full of keywords, braces, and semicolons. Mastering its variable declarations, function patterns, and control flow lets you brew bug-free scripts. Once you know the rules, you'll debug errors in a snap and write code that sings! Deep dive into syntax essentials
  2. Explore JS Syntax
  3. Grasp the Concept of Hoisting - Hoisting is JavaScript's sneaky move of shuffling declarations to the top before running your code. Knowing how var, let, const, and function declarations behave under the hood helps you avoid "undefined" surprises. Embrace hoisting and turn it into your secret weapon for cleaner code. Unmask JavaScript hoisting
  4. Learn about Hoisting
  5. Explore Closures and Scope - Closures let functions remember the environment where they were created, even after that outer function finishes. This superpower enables data privacy, function factories, and powerful callback patterns. Get ready to encapsulate variables and write more modular code! Unlock closure mysteries
  6. Discover Closures
  7. Master ES6 Arrow Functions - Arrow functions are the speed-runners of JavaScript: concise, elegant, and carrying a bonus gift - lexical this binding. Say goodbye to .bind tricks and hello to cleaner callbacks and array methods. They're perfect for one-liners and intuitive function expressions! Sharpen your arrow skills
  8. Study Arrow Functions
  9. Utilize Template Literals - Template literals let you weave variables directly into strings using backticks, and even span multiple lines without fuss. No more juggling quotes or plus signs - just `$` magic. This friendly feature boosts readability and keeps your code looking crisp. Play with template literals
  10. Try Template Literals
  11. Understand Promises for Asynchronous Programming - Promises are your asynchronous superheroes, replacing callback chaos with .then(), .catch(), and .finally() chains. They make error handling predictable and let you sequence tasks like a pro. Once you master promises, async code becomes a breeze. Conquer promise patterns
  12. Learn Promises
  13. Optimize DOM Manipulation - The Document Object Model is your playground, but heavy-handed tweaks can slow down your pages. Learn batch updates, document fragments, and efficient selectors to keep things smooth. Your users will thank you for lightning-fast interactions! Speed up your DOM
  14. Optimize the DOM
  15. Handle Events Effectively - Events bring your web pages to life, but unorganized listeners can cause performance hiccups. Master event delegation, propagation control, and listener removal to manage clicks, scrolls, and keystrokes like a conductor. Get ready for highly interactive apps! Orchestrate event flow
  16. Study Event Handling
  17. Implement Callback Functions - Callbacks are the original async pattern in JavaScript - functions you pass around to run later. Understanding how they fit into event loops and function pipelines is essential for responsive apps. Soon you'll be chaining and nesting callbacks with confidence (and maybe a sprinkle of humor). Callback mastery guide
  18. Explore Callbacks
  19. Evaluate Performance Considerations - Tiny tweaks in JavaScript can have big performance impacts, especially when manipulating the DOM or handling high-frequency events. Learn profiling tools, debouncing, and throttling to keep your app running at top speed. Happy users, happy life! Tune your code
  20. Optimize Performance
Powered by: Quiz Maker