var due to function-scoping and hoisting issues:
- const: For values that never change (base URLs, test timeouts, page titles).
- let: For values that get reassigned (retry counters, iteration indices).const baseUrl = "https://targetqa.com";
let attemptCount = 0;
attemptCount++;string, number, boolean, null, undefined, symbol, bigint.
2. null vs undefined:
- undefined: A variable declared but not assigned a value.
- null: An intentional assignment representing "no object/value".=== (strict equality), !==, >, <, >=, <=.
- Logical: && (AND), || (OR), ! (NOT).
- Ternary: const status = isPassed ? "PASSED" : "FAILED";if (responseStatus === 200) {
console.log("Success");
} else if (responseStatus === 404) {
console.log("Not Found");
} else {
console.log("Unexpected status: " + responseStatus);
}// Standard for loop:
for (let i = 0; i < 3; i++) {
console.log("Retry attempt: " + i);
}// for...of loop (iterates over values in array):
const tabs = ["Home", "Courses", "Practice"];
for (const tab of tabs) {
console.log("Checking tab: " + tab);
}
// for...in loop (iterates over object keys):
const testConfig = { browser: "chromium", headless: true };
for (const key in testConfig) {
console.log(key + ": " + testConfig[key]);
}