- Introduction to JavaScript
- What is JavaScript?
- JavaScript vs HTML vs CSS
- History and Versions (ES5, ES6+)
- Setting Up JavaScript
- Adding JavaScript to HTML
- Inline, Internal, and External Scripts
- Using the Console (Developer Tools)
- Basic Syntax
- Statements & Semicolons
- Comments (Single-line & Multi-line)
- Case Sensitivity
- Variables
- var, let, and const
- Variable Naming Rules
- Data Types
- String, Number, Boolean, Null, Undefined, Symbol, BigInt
- Type Conversion & Coercion
- Operators
- Arithmetic, Assignment
- Conditional Statements
- if, else if, else
- switch statement
- Loops and Iteration
- for, while, do…while
- Function Declaration & Expression
- Parameters and Return
- Arrow Functions
- IIFE (Immediately Invoked Function Expression)
- Scopes
- Lexical Scope
- Hoisting
- Closures
- Callback Functions
- Strict Mode (“use strict”)
- Print Numbers from 1 to N (JavaScript)
- Sum of N Natural Numbers (JavaScript)
- Even or Odd Number (JavaScript)
- Find Largest of 2 and 3 Numbers (JavaScript)
- Swap Two Numbers (JavaScript)
- Reverse a Number (JavaScript)
- Check for Palindrome Number (JavaScript)
- Check for Prime Number (JavaScript)
- Generate N Prime Numbers (JavaScript)
- Factorial of a Number (JavaScript)
JavaScript Basics & Syntax Quiz
Question 1 of 34
00:00
When was JavaScript first released?
Hint: It was developed by Brendan Eich at Netscape.
What was JavaScript originally called?
Hint: Think about a popular coffee drink.
Which organization standardizes JavaScript?
Hint: The standard is often referred to by its organization's name.
Which keyword allows variable re-declaration and re-assignment?
Hint: This keyword has function scope.
Which keyword has block scope but allows re-assignment?
Hint: Introduced in ES6.
Which keyword is used to declare a constant whose value cannot be re-assigned?
Hint: Short for 'constant'.
What is the scope of a variable declared with 'var' inside a 'for' loop?
Hint: It's not limited to the loop block itself.
What is the data type of `typeof 42` in JavaScript?
Hint: It's a numerical value.
Which of the following is NOT a primitive data type in JavaScript?
Hint: It can hold collections of data.
What will `typeof null` return?
Hint: This is a well-known quirk of JavaScript.
What is the data type of a variable that has been declared but not assigned a value?
Hint: It literally means 'not defined yet'.
What is the result of `10 % 3` in JavaScript?
Hint: This is the remainder operator.
Which operator is used for strict equality comparison (checks both value and type)?
Hint: It has three equal signs.
What is the output of `'5' + 2`?
Hint: When one operand is a string, the '+' operator performs concatenation.
Which operator assigns a value to a variable?
Hint: It's a single equal sign.
Which conditional statement is best suited for checking multiple possible values of a single variable?
Hint: It uses 'case' and 'break' keywords.
What will be the output of the following code? `if ('0') { console.log('True'); } else { console.log('False'); }`
Hint: Consider 'truthy' and 'falsy' values in JavaScript.
What is the purpose of the `default` keyword in a `switch` statement?
Hint: It acts as a fallback.
Which loop is guaranteed to execute its block at least once?
Hint: The condition is checked after the block is executed.
What is the purpose of the `break` statement in a loop?
Hint: It exits the loop entirely.
How many times will the following loop run? `for (let i = 0; i < 5; i++) { /* code */ }`
Hint: Count from 0 up to (but not including) 5.
What is the primary purpose of a JavaScript function?
Hint: It promotes code reusability.
What is 'global scope' in JavaScript?
Hint: Think about variables defined outside any function.
What happens if a function does not explicitly return a value?
Hint: It's the default return value.
How do you access the first element of an array named `myArray`?
Hint: Array indices start from zero.
Which method adds one or more elements to the end of an array and returns the new length?
Hint: Think about adding something to the end of a list.
How do you find the number of elements in an array named `arr`?
Hint: It's a property, not a method.
Which method is used to convert a string to uppercase?
Hint: It's a common method for string case conversion.
What will `'Hello World'.indexOf('World')` return?
Hint: Count the characters, remembering spaces are characters too, and indices start at 0.
How do you concatenate two strings, `str1` and `str2`?
Hint: There are multiple common ways.
What is the result of `Number('10') + 5`?
Hint: The `Number()` function explicitly converts to a number.
What is 'type coercion' in JavaScript?
Hint: It happens behind the scenes, automatically.
What will be the result of `Boolean('')`?
Hint: Empty strings are considered 'falsy'.
What is `parseInt('10.5pixels')`?
Hint: It parses an integer.
Review Your Answers
Quiz Results
×