1/92
Looks like no tags are added yet.
What is JavaScript?
A programming language used to store, compute, reuse, and search information in programs.
What is a data type?
Describes what kind of value is used and which operations JavaScript can perform on it.
What are the seven primitive types in JavaScript?
String, Number, BigInt, Boolean, Undefined, Null, and Symbol.
What is a reference type?
A type commonly represented by Object, including objects, arrays, and functions.
What does the typeof operator do?
Inspects a value's type.
What is a String?
A data type that represents text, such as "Hello", 'JavaScript', or Welcome, ${name}!.
What is string concatenation?
Combining strings, commonly using +. Example: let fullName = firstName + lastName;.
What are common string operations?
Checking length, searching within text, and extracting part of a string.
What does toUpperCase() do?
Converts text to uppercase.
What does toLowerCase() do?
Converts text to lowercase.
What does includes() do?
Checks whether text contains a specified piece of text.
What does slice() do?
Extracts part of a string.
What is the Number data type?
Represents numeric values used in calculations. Example: let total = 150 * 3;.
What is a Boolean?
A value representing a true/false condition: true or false.
What is a comparison operator?
Compares values and produces a Boolean. Example: 10 > 5 returns true.
What are JavaScript's logical operators?
&& means AND, || means OR, and ! means NOT.
What does undefined represent?
A value that has not been assigned.
What does null represent?
An intentional absence of a value.
What is an Object?
A structure that groups related properties and values.
What is an Array?
An ordered collection of values. Example: let scores = [85, 90, 92];.
What is dot notation?
Accesses a property by name, such as student.name.
What is bracket notation?
Accesses a property or array item using brackets, such as scores[0].
What is an expression?
A piece of code that produces a value.
What are JavaScript's arithmetic operators?
+ addition, - subtraction, * multiplication, / division, % remainder, and ** exponentiation.
What are assignment operators?
Operators that assign or update values, such as =, +=, -=, *=, and /=.
What are common comparison operators?
===, !==, >, <, >=, and <=.
What is an average expression?
An expression that calculates the mean. Example: let average = (score1 + score2) / 2;.
What is operator precedence?
The order in which JavaScript evaluates parts of an expression.
How do parentheses affect operator precedence?
They are evaluated first and clarify the intended order of operations.
Which operators generally take precedence over addition and subtraction?
Multiplication, division, and remainder.
What is the result of 10 + 5 * 2?
20, because multiplication happens before addition.
What is the result of (10 + 5) * 2?
30, because the parentheses are evaluated first.
What does strict equality (===) check?
Whether values are equal without converting them to another type.
What does strict inequality (!==) check?
Whether values are not strictly equal.
What is conditional logic?
Using conditions to control program decisions.
What is an if statement?
Runs code when a condition is true. Example: if (age >= 18) { ... }.
What does else do?
Provides an alternative branch when the if condition is not true.
How can multiple conditions be combined?
Use && for AND and || for OR.
What is a function?
A reusable block of code that performs a task.
What is a function declaration?
Defines a function using the function keyword. Example: function greet(name) { return name; }.
What is a parameter?
A named input received by a function.
What does return do in a function?
Sends a result back from a function.
What is a function call?
Runs a function. Example: greet("Ana").
What is a function expression?
Stores a function in a variable. Example: const add = function(a, b) { return a + b; };.
What is an arrow function?
A concise function syntax. Example: const add = (a, b) => a + b;.
What are the benefits of functions?
They support reuse, organization, testing, and reduced repetition.
How should you choose a function style?
Choose a style that keeps code clear and consistent.
What is a method?
A function associated with an object or value.
What is the difference between a function and a method?
A function is a reusable action; a method is accessed through an object or value.
What are examples of string methods?
text.toUpperCase() and text.includes("JS").
What does the array push() method do?
Adds an item to an array. Example: scores.push(95).
What does the array map() method do?
Transforms each item in an array into a corresponding result.
What does the array filter() method do?
Selects array items that meet a specified condition.
What does the array reduce() method do?
Combines array items into a single accumulated result.
How can reduce() calculate a sum?
Example: scores.reduce((sum, score) => sum + score, 0).
How can JavaScript calculate an average and status?
Calculate the sum with reduce(), divide by the array length, then use a condition such as average >= 75 ? "Passed" : "Needs Improvement".
What are object methods?
Methods associated with objects that can operate on the object's data.
What is pattern matching?
Checking whether text follows a desired structure for searching, filtering, extracting, or validating.
What is a regular expression (RegExp)?
A description of a text pattern used for flexible text matching in JavaScript.
What are common uses of pattern matching?
Finding digits, detecting keywords, checking simple email formats, validating forms, and cleaning data.
How is a regular expression literal written?
/pattern/flags.
What does [A-Z] match?
Any uppercase letter from A through Z.
What does [0-9] match?
Any digit from 0 through 9.
What does \d mean in a regular expression?
Matches a digit.
What does \w mean in a regular expression?
Matches a word character, generally a letter, digit, or underscore.
What does \s mean in a regular expression?
Matches whitespace, such as spaces or tabs.
What does the + quantifier mean?
Matches one or more occurrences.
What does the * quantifier mean?
Matches zero or more occurrences.
What does the ? quantifier mean?
Makes the preceding element optional.
What does {n} mean in a regular expression?
Matches exactly n repetitions of the preceding element.
What does the ^ anchor mean?
Marks the beginning of a string or line, depending on flags.
What does the $ anchor mean?
Marks the end of a string or line, depending on flags.
What does /^\d{4}$/ match?
Exactly four digits in the entire string.
What does the RegExp test() method do?
Tests whether text matches a regular expression and returns true or false.
What does /^\d+$/.test("123") return?
true, because the string contains one or more digits only.
What does the match() method do?
Returns matched text. Example: "Room 123".match(/\d+/).
What does the replace() method do?
Replaces matching text. Example: text.replace(/\s+/g, " ").
What does the search() method do?
Returns the position of a match, or -1 if no match is found.
What does the g regular expression flag mean?
Global matching, finding all matches instead of stopping after the first.
What does the i regular expression flag mean?
Case-insensitive matching.
What does the m regular expression flag mean?
Multiline mode, changing how ^ and $ match line boundaries.
How can a student ID like 2026-00123 be validated?
Use /^\d{4}-\d{5}$/ and test the ID with pattern.test(studentID).
What does the student ID pattern /^\d{4}-\d{5}$/ require?
Four digits, a hyphen, then five digits, with no extra characters.
What is a validation rule?
A rule used to check whether input meets specified requirements.
Why should validation rules match actual requirements?
To avoid accepting invalid input or rejecting valid input.
How do JavaScript concepts work together in a student registration form?
Data types store student information; expressions calculate values; functions organize processing; methods manipulate data; regex validates structured inputs.
What is the difference between = and ===?
= assigns a value, while === checks strict equality.
What should you remember about array indexing?
Array indexes start at 0, not 1.
What can happen when a function is called without required arguments?
It may not work as intended because expected inputs are missing.
What happens when a regular expression is too broad?
It may accept invalid input.
What happens when a regular expression is too strict?
It may reject valid input.
What are useful JavaScript debugging tips?
Test small pieces, inspect values with console.log(), and use clear variable names.
What makes code readable?
Code that is predictable, clearly named, organized, and easy to test.