Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- Client-side scripting: runs in the browser: responsive, less server load. Downsides: can be disabled, browser differences, code is visible.
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- Add JS inline (attributes), embedded (<script>), or external (<script src>), usually at the end of body or with defer.
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- Primitives: number, string, boolean, null, undefined, symbol, bigint. Objects (arrays, functions) are reference types.
Exam weight Low
Exam weight High
- let: block-scoped, can be reassigned. const: block-scoped, can’t be reassigned (but a const object’s contents CAN change). Avoid var.
Exam trapconst arr = [1]; arr.push(2) is fine: the binding is constant, not the array.
🎯 How this can come up · 1 question
MCQ
const x = {a: 1}; x.a = 2; results in:
Correct: x.a is 2.
Exam weight Low
Exam weight Low
Exam weight High
- converts types before comparing; = compares value AND type. "5" 5 is true, "5" = 5 is false.
🎯 How this can come up · 1 question
MCQ
"5" === 5 evaluates to:
Correct: false.
Exam weight Low
Exam weight High
- Falsy values: false, 0, "", null, undefined, NaN. Everything else is truthy ("0", [], {} included).
🎯 How this can come up · 1 question
MCQ
Which value is falsy?
Correct: "".
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- Array destructuring: const [a, b] = [1, 2];
Exam weight Low
Exam weight Low
Exam weight Low
- Object literal: const p = {name: "Ali", age: 20}; access with p.name or p["name"].
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- Object destructuring uses the property NAMES: const {name, age} = p;
Exam weight Low
Exam weight High
- JSON: text format for data. JSON.stringify(obj) → string; JSON.parse(str) → object. Keys must be double-quoted.
🎯 How this can come up · 1 question
MCQ
Which converts a JSON string into a JavaScript object?
Correct: JSON.parse().
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- Rest parameters: function sum(...nums) collects remaining arguments into an array.
Exam weight Low
Exam weight Low
- Hoisting: function declarations are moved to the top (callable before definition); function expressions and let/const are not usable before their line.
Exam weight Low
- Callback: a function passed to another function to be called later.
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- Arrow functions: (a, b) => a + b. Shorter; they don’t have their own this.
Exam weight Low
- Scope: global, function (local), block (let/const inside { }).
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight High
- filter returns the elements that pass a test; map returns a new array of transformed elements; find returns the FIRST match.
🎯 How this can come up · 2 questions
MCQ
[1, 2, 3, 4].filter(n => n % 2 === 0) returns:
Correct: [2, 4].
MCQ
[1, 2, 3].map(n => n * 2) returns:
Correct: [2, 4, 6].
Exam weight Low
- reduce combines all elements into one value: [1, 2, 3].reduce((acc, n) => acc + n, 0) → 6.
Exam weight High
- sort() sorts as STRINGS by default: [10, 9, 1].sort() → [1, 10, 9]. Use sort((a, b) => a − b) for numbers.
Exam trapDefault sort is lexicographic.
Exam weight Low
Exam weight Low
Exam weight Low
No slides match this filter.


































