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 QuizThis quiz contains 15 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.
Which of the following is a valid function declaration in JavaScript?
Correct answer: function greet() { console.log('Hello'); }
How do you correctly write a function expression assigned to a variable?
Correct answer: var hello = function() { return 'Hi'; }
Which of these correctly defines an arrow function that takes one parameter 'x' and returns 'x*2'?
Correct answer: const double = x => x * 2;
How would you specify a default value of 10 for the parameter 'num' in this function: function multiply(num) { ... }?
Correct answer: function multiply(num = 10) { ... }
If a function is defined as function sayHello(name) { console.log('Hello ' + name); }, how do you call it for the name "Alex"?
Correct answer: sayHello('Alex');
What will console.log(output) print in the following code: { let output = 'inside'; } console.log(output);?
Correct answer: It throws a ReferenceError
What is the result of calling a function declared as function greet() { return 'Hi'; } before its definition in the code?
Correct answer: It works because the function is hoisted
Which example shows an anonymous function being passed as an argument to another function?
Correct answer: setTimeout(function() { alert('Hi'); }, 1000);
What is a closure in JavaScript?
Correct answer: A function that remembers the environment in which it was created
What term describes a function that calls itself directly or indirectly in JavaScript?
Correct answer: Recursive function
Which arrow function correctly returns the sum of 'a' and 'b'?
Correct answer: const add = (a, b) => a + b;
If you declare a variable with 'var' inside a function, where is it accessible?
Correct answer: Only inside that function
What is the correct term for the value passed to a function when calling it?
Correct answer: Argument
What will the following code print: function test() { return 5; } console.log(test());
Correct answer: 5
What will the following output: function greet(name = 'Friend') { console.log('Hi ' + name); } greet();
Correct answer: Hi Friend