---
title: "JavaScript: Language Fundamentals & Modern Features"
description: "Test your knowledge of JavaScript fundamentals with this quiz covering variables, data types, functions, promises, DOM manipulation, ES6 features, closures, and modern JavaScript programming best practices."
author: "Mohammad Abu Mattar"
canonical: https://mkabumattar.com/quizzes/post/javascript-fundamentals-quiz
---

# JavaScript: Language Fundamentals & Modern Features

Welcome to the JavaScript Basics Quiz! This quiz tests your understanding of fundamental JavaScript concepts, syntax, and modern programming best practices. Each question is multiple-choice, and you'll find hints to help you along the way. Good luck!

## Questions

### 1. Which keyword is used to declare a block-scoped variable that can be reassigned?

- `var`
- `let`
- `const`
- `set`

**Hint:** Introduced in ES6 to replace "var".

### 2. What is the result of "5" + 2 in JavaScript?

- `7`
- `"52"`
- `NaN`
- `undefined`

**Hint:** JavaScript prioritizes string concatenation with the + operator.

### 3. How do you create a function using the arrow syntax?

- `function my_func => {}`
- `const my_func = () => {}`
- `let my_func = func() {}`
- `my_func() -> { return }`

**Hint:** Uses the "fat arrow" symbol =>.

### 4. What does "===" check that "==" does not?

- The scope of the variables
- Both the value and the type
- Memory address consistency
- Function execution status

**Hint:** Think about data types.

### 5. Which method is used to write text directly into the browser console?

- `print.log()`
- `console.log()`
- `debug.write()`
- `terminal.out()`

**Hint:** Starts with "c".

### 6. What is the purpose of "document.querySelector()"

- Modifying the page window
- Selecting an element by CSS
- Creating new script tags
- Refreshing the document

**Hint:** It interacts with the HTML page.

### 7. Which of these is NOT a valid way to declare a variable in modern JS?

- `let`
- `set`
- `var`
- `const`

**Hint:** One of these is from a different language.

### 8. What is a "Promise" in JavaScript?

- A syntax for error suppression
- An object for async task state
- A lock for immutable variables
- A server-side validation rule

**Hint:** Used for asynchronous operations.

### 9. Which array method creates a new array by performing a function on every element?

- `forEach()`
- `map()`
- `filter()`
- `push()`

**Hint:** It "maps" values to new values.

### 10. What does the "this" keyword refer to in a standard object method?

- The root execution context
- The object owning the method
- The internal prototype chain
- The parent function caller

**Hint:** It refers to the owner.

### 11. How do you convert a JSON string into a JavaScript object?

- `JSON.stringify()`
- `JSON.parse()`
- `Object.convert()`
- `String.toJSON()`

**Hint:** You "parse" the string.

### 12. What is "Hoisting" in JavaScript?

- Uploading files to a server
- Moving declarations to the top
- Increasing memory allocation
- Optimizing function calls

**Hint:** Variables and functions being moved to the top.

### 13. Which operator is used to spread the elements of an array into another array?

- `...`
- `***`
- `&&&`
- `!!!`

**Hint:** Three dots.

### 14. What is an "anonymous function"?

- A function with hidden code
- A function without a name
- A function that only runs once
- A function for private scopes

**Hint:** A function with no name.

### 15. Which of these is a "falsy" value in JavaScript?

- `"0"`
- `0`
- `[]`
- `{}`

**Hint:** Something that behaves like False in an "if" statement.

### 16. What is the purpose of the "async" keyword?

- To increase processing speed
- To return a Promise object
- To encrypt server requests
- To bypass the event loop

**Hint:** It prepends a function definition.

### 17. How do you check the length of an array "myArr"?

- `myArr.count()`
- `myArr.length`
- `myArr.size`
- `len(myArr)`

**Hint:** Property name.

### 18. What does "DOM" stand for?

- Data Object Model
- Document Object Model
- Digital Ordinary Map
- Direct Output Mode

**Hint:** The structure of the webpage.

### 19. Which keyword is used to stop a loop immediately?

- `stop`
- `break`
- `exit`
- `halt`

**Hint:** Same as in Java or Python.

### 20. What is the "event bubble"?

- A visual tooltip element
- Event propagation upwards
- A browser memory error
- A recursive function call

**Hint:** How events travel up the DOM.

### 21. Which symbol is used for template literals?

- `Double quotes (" ")`
- `Backticks (` `)`
- `Single quotes (' ')`
- `Tildes (~ ~)`

**Hint:** The key next to the "1".

### 22. What is the purpose of "use strict"?

- To encrypt source code
- To enforce cleaner code
- To allow legacy support
- To minify script files

**Hint:** It makes JS less "loose".

### 23. What is "null" in JavaScript?

- An undeclared variable
- Intentional empty value
- The numeric value of 0
- A boolean false state

**Hint:** An intentional absence.

### 24. Which method adds an item to the BEGINNING of an array?

- `push()`
- `unshift()`
- `shift()`
- `prepend()`

**Hint:** The opposite of push.

### 25. What does "NaN" stand for?

- Null and Negative
- Not a Number
- No active Network
- New assigned Node

**Hint:** Not A...

### 26. Which function is used to execute a block of code after a specified delay?

- `setInterval()`
- `setTimeout()`
- `wait()`
- `sleep()`

**Hint:** One-time delay.

### 27. How do you check if an object has a specific property?

- `object.exists(key)`
- `key in object`
- `object.contains(key)`
- `object.has(key)`

**Hint:** Checks the keys.

### 28. What is a "Closure"?

- Closing browser window
- Persistent scope access
- Ending a loop execution
- A private API endpoint

**Hint:** A function remembering its home.

### 29. Which keyword is used to inherit from another class?

- `inherits`
- `extends`
- `implements`
- `super`

**Hint:** It "extends" the functionality.

### 30. What is the default return value of a function that doesn't return anything?

- `null`
- `undefined`
- `false`
- `0`

**Hint:** It is not defined.
