Frequently Asked Questions
What this playlist answers
10 questions this playlist covers — skim
them for a quick takeaway, or dive into the videos above for the full picture.
This seven-part learning path covers the core building blocks of JavaScript for web development: comparison operators, user input, objects, arrays, functions and parameters, loops and iteration, and conditional branching with if, else, and switch statements.
The == operator compares values after type coercion, converting them to a common type first, while === compares both value and data type without conversion. For example, the string 10 compared to the number 10 is equal with == but not with ===, which is why strict equality is the recommended best practice.
JavaScript collects user input through built-in browser functions and form elements. prompt() asks for text and returns it as a string, alert() displays a message, and confirm() returns true or false, while form fields and event handlers capture input in real applications. Input should be validated and converted to the right type before use.
JavaScript objects are collections of key-value pairs used to store structured data, where each key is a property and each value can be any data type, including functions called methods. Objects are reference types, so variables store a reference to the same object in memory rather than a copy.
JavaScript arrays are ordered collections of values stored in a single variable. They use zero-based indexing, so the first element is at index 0, and they support built-in methods such as push(), pop(), shift(), unshift(), map(), and filter() for managing data.
Arrays store ordered data accessed by numeric indexes, which makes them ideal for lists of items. Objects store data as named key-value pairs, which makes them better for describing a single entity with multiple properties.
Parameters are the variables listed in a function definition, while arguments are the actual values passed in when the function is called. Functions can also define default parameters and use the return keyword to send a result back to the caller.
A for loop is typically used when the number of iterations is known, combining initialization, condition, and increment in one line. A while loop keeps running as long as a condition is true, and forEach offers a simpler way to run a function on every element of an array.
if-else statements evaluate one or more conditions and can handle complex expressions, while switch statements compare a single value against several predefined cases. switch provides a cleaner structure when checking one variable against many possible values.
Truthy and falsy values determine how non-boolean values behave in conditions. false, 0, null, undefined, NaN, and empty strings are falsy, while most other values are truthy, which matters when writing reliable conditional logic.