What does the “dot” operator do? Code example:
const buttons = optionsContainer.querySelectorAll("button");In JavaScript, the dot operator (.) is used to access properties and methods of objects.
It’s essentially how you “drill down” into an object to reach specific data or behavior. hink of it like this:
The dot means “of”.
So:
optionsContainer.querySelectorAll → “the querySelectorAll method of optionsContainer”.
Does querySelectorAll() need the dot before the class name?
Yes
Does getElementsByClassName need the dot before the class name?
No
What’s the difference between
logos.forEach(logo => ()); and logos.forEach(logo => {});
() => () → Implicit return.
Used for single-line expressions where you immediately return a value.
Example:
const squares = nums.map(n => n * n);
() => {} → Block body.
Used for multiple statements. You must use return explicitly if you want to return something.
Example:
const squares = nums.map(n => {
const result = n * n;
return result;
});