JSE Certified Entry-Level JavaScript Programmer study materials
JSE Certified Entry-Level JavaScript Programmer study resources

JSE Certified Entry-Level JavaScript Programmer cheat sheet

JSE Certified Entry-Level JavaScript Programmer · Keep the key ideas within reach.

Quick reference

JavaScript Basics and Syntax

  • JavaScript is case-sensitive: variable, Variable, and VARIABLE are three distinct identifiers.

  • Statements end with a semicolon or rely on automatic semicolon insertion (ASI); ASI inserts a semicolon only at a line break that cannot continue the statement, so a line starting with ( or [ can silently merge with the previous line.

  • Comments: // runs to end of line; /* ... */ spans lines and cannot nest.

  • Identifiers may contain letters, digits, $, and _, but cannot start with a digit; reserved words such as class, return, and let cannot be used as names.

  • A script's default execution order is top-to-bottom; scripts without defer or type="module" block HTML parsing while they load and run.

  • Strict mode is enabled by 'use strict'; at the top of a script or function body, and it turns silent errors (assignment to undeclared variables, duplicate parameter names) into thrown errors.

  • Numeric literals: 0x1F is hexadecimal (31), 0o17 octal (15), 0b101 binary (5), and 1e3 equals 1000.

  • JavaScript is dynamically typed: a variable's type is determined by its current value, not by its declaration.

Quick reference

Variables, Data Types, and Type Coercion

  • var is function-scoped and hoisted with value undefined; let and const are block-scoped and hoisted but stay in the temporal dead zone until their declaration executes.

  • const prevents reassignment of the binding, not mutation of the referenced object: const a = [1]; a.push(2) is legal, a = [3] throws TypeError.

  • Seven primitive types: string, number, boolean, undefined, null, symbol, bigint; everything else (including arrays and functions) is an object.

  • typeof returns 'undefined', 'boolean', 'number', 'bigint', 'string', 'symbol', 'function', or 'object'; typeof null is 'object' and typeof NaN is 'number'.

  • null == undefined is true, but null === undefined is false; NaN is the only value not equal to itself, so use Number.isNaN(x) to test it.

  • Falsy values are exactly false, 0, -0, 0n, '', null, undefined, and NaN; every object, including [] and {}, is truthy.

  • Abstract equality (==) coerces: if one side is a number and the other a string, the string is converted with ToNumber; if one side is a boolean, it is converted to a number first.

  • Relational comparison of a string and a number converts the string to a number, so '10' < 9 is false while '10' < '9' is true (lexicographic).

  • Explicit conversions: Number('') is 0, Number('12px') is NaN, parseInt('12px') is 12, Boolean('0') is true, String(null) is 'null'.

Quick reference

Operators and Expressions

  • Operator precedence (high to low, selected): member access and call, new, postfix ++/--, unary ! ~ + - typeof void delete, **, * / %, + -, << >> >>>, < <= > >= in instanceof, == != === !==, &, ^, |, &&, ||, ??, ?:, assignment, comma.

  • Exponentiation ** is right-associative: 2 ** 3 ** 2 evaluates to 512, and unary minus before ** is a SyntaxError without parentheses.

    • is overloaded: if either operand is a string (or is converted to one by an object's ToPrimitive), concatenation occurs; otherwise numeric addition.
  • && returns the first falsy operand or the last operand; || returns the first truthy operand or the last operand; both short-circuit and return values, not booleans.

  • ?? returns the right operand only when the left is null or undefined, so 0 ?? 5 is 0 while 0 || 5 is 5; mixing ?? with && or || without parentheses is a SyntaxError.

  • Assignment operators: x += y is x = x + y, and compound forms apply the same coercion rules as the underlying operator.

  • The conditional operator is the only ternary operator: condition ? exprIfTrue : exprIfFalse, and it associates right-to-left.

  • in tests property presence in an object (or index in an array); instanceof tests whether an object's prototype chain contains the constructor's prototype.

  • The comma operator evaluates operands left to right and yields the last value: (1, 2, 3) is 3.

Quick reference

Control Flow and Loops

  • if / else if / else evaluates conditions top-down and runs only the first truthy branch; a bare if with a non-block body binds only the single next statement.

  • The switch statement compares cases with strict equality (===); without break or return, execution falls through into subsequent cases, and default may appear anywhere.

  • for (init; test; update) runs init once, tests before each iteration, and runs update after each body execution; omitting the test makes the condition always true.

  • for...in iterates enumerable property keys, including inherited ones; for...of iterates values from iterables (arrays, strings, Map, Set) and does not work on plain objects.

  • while tests before the body; do...while runs the body at least once because the test comes after.

  • break exits the innermost loop or switch; continue skips to the next iteration; labeled statements (outer: for(...)) let break outer and continue outer target a specific loop.

  • for...of over a string iterates Unicode code points, so an emoji counts as one iteration rather than two UTF-16 code units.

  • Array.prototype.forEach always visits every element and cannot be stopped with break; use for...of, some, or every when early exit is needed.

Quick reference

Functions and Scope

  • Function declarations are hoisted with their body and are callable before their definition; function expressions and arrow functions assigned to let/const are not.

  • A function without an explicit return returns undefined; return with no value also yields undefined.

  • Parameters without arguments are undefined; extra arguments are ignored by named parameters but available through the arguments object (not in arrow functions) or rest parameters (...args).

  • Default parameters apply only when the argument is undefined (not null) and are evaluated at call time, left to right.

  • Arrow functions do not bind their own this, arguments, super, or new.target; they inherit this lexically and cannot be used as constructors.

  • Scope chain lookup goes outward from the current scope; inner scopes can read outer variables, but outer scopes cannot read inner ones.

  • A closure is a function plus the lexical environment it captured; it keeps outer variables alive after the outer function returns.

  • var inside a function is scoped to that function; a var declaration in a block is hoisted to the enclosing function, while let/const stay in the block.

  • IIFE syntax (function(){ ... })(); requires the wrapping parentheses so the parser reads a function expression rather than a declaration.

Quick reference

Arrays and Objects

  • Arrays are zero-indexed objects with a length property; length is one greater than the highest index and is writable, so arr.length = 1 truncates the array.

  • Mutating array methods: push/pop act at the end, shift/unshift at the start, splice changes contents in place, and sort/reverse reorder in place.

  • Non-mutating methods: slice, concat, map, filter, and the spread form [...arr] return new arrays; forEach returns undefined.

  • map, filter, and forEach skip holes in sparse arrays; reduce without an initial value uses the first element as the accumulator and throws TypeError on an empty array.

  • sort compares elements as strings by default, so [10, 9, 1].sort() gives [1, 10, 9]; supply (a, b) => a - b for numeric order.

  • Object literals use key: value pairs; property keys are strings or symbols, and numeric-looking keys are converted to strings.

  • Dot access needs a valid identifier; bracket access accepts any expression, so obj['first-name'] and obj[key] work where dot syntax fails.

  • delete removes an own property (returns true) but does not affect the prototype chain; Object.keys, values, and entries list only own enumerable properties.

  • Shallow copy: Object.assign({}, obj) and {...obj} copy top-level properties only; nested objects remain shared references.

  • Destructuring pulls values out by position or key: const [a, b] = arr and const {x, y = 5} = obj, where the default applies when the value is undefined.

Quick reference

Built-in Objects and Standard Library

  • String methods are immutable: slice, substring, and substr return new strings; substring swaps arguments when start > end, while slice returns '' for that case.

  • String.prototype methods: indexOf returns -1 when absent, includes returns a boolean, and split('') returns an array of UTF-16 code units.

  • Template literals use backticks, allow multi-line text, and interpolate with ${expression}; tagged templates receive the strings array plus the substitution values.

  • Math.round rounds half up (Math.round(-1.5) is -1), Math.floor always rounds down, Math.trunc drops the fraction, and Math.max() with no arguments returns -Infinity.

  • Number methods: toFixed(n) returns a string with n decimals, Number.isInteger checks without coercion, and Number.parseInt differs from global parseInt only by being non-coercive on the input.

  • JSON.stringify converts undefined, functions, and symbols to omission in objects and null in arrays; JSON.parse throws SyntaxError on invalid text.

  • Date months are zero-based (0 = January) while getDate days of the month are one-based; getTime returns milliseconds since 1970-01-01 UTC.

  • Map keys may be any type and preserve insertion order; Set stores unique values; both expose size as a property, not a method.

  • Array.isArray(x) distinguishes arrays from array-like objects, and Object.prototype.toString.call(x) reveals types such as '[object Date]'.

Quick reference

Error Handling and Debugging

  • try runs first; if it throws, control jumps to catch (which receives the error object); finally always runs, even after return or a rethrow.

  • Built-in error constructors: Error, TypeError, RangeError, ReferenceError, SyntaxError, and URIError; each instance has name, message, and stack.

  • throw accepts any value, but throwing an Error instance preserves the stack trace; rethrow with throw err inside catch when the error is not handled.

  • ReferenceError occurs when reading an undeclared identifier; TypeError occurs when calling a non-function or reading a property of undefined/null.

  • SyntaxError is thrown at parse time, so a try/catch around code in the same script cannot catch it; only eval or new Function defer parsing to runtime.

  • A try block requires either catch or finally; using try with neither is a SyntaxError.

  • Optional chaining obj?.prop and nullish coalescing obj ?? fallback prevent TypeErrors from null or undefined intermediate values.

  • console methods: log, warn, error, table, and time/timeEnd for measuring elapsed milliseconds; debugger pauses execution when developer tools are open.

  • Custom errors extend Error: class ValidationError extends Error { constructor(m){ super(m); this.name = 'ValidationError'; } }.

Quick reference

DOM Basics and Events

  • document.querySelector returns the first match for a CSS selector or null; querySelectorAll returns a static NodeList that does not update when the DOM changes.

  • getElementById returns an Element or null; getElementsByClassName and getElementsByTagName return live HTMLCollections that update automatically.

  • Creating nodes: document.createElement('div') builds an element, textContent sets text safely, and appendChild or append inserts it into the tree.

  • textContent includes all text and is not parsed as HTML; innerHTML parses markup and is an injection risk with untrusted input.

  • classList.add, remove, toggle, and contains manipulate classes without string parsing; element.style.prop sets inline styles (camelCase, e.g. backgroundColor).

  • addEventListener(type, handler, options) registers multiple handlers per event; options include once, capture, and passive.

  • The event object carries type, target (the element that dispatched), and currentTarget (the element whose listener is running); preventDefault cancels default behavior, stopPropagation halts bubbling.

  • Events flow capture (window to target) then target then bubble (target to window); useCapture or {capture:true} listens during the capture phase.

  • DOMContentLoaded fires after HTML is parsed, before images load; window load fires after all resources; defer scripts run before DOMContentLoaded.

Quick reference

Error Handling and Debugging

  • try runs first; if it throws, control jumps to catch (which receives the error object); finally always runs, even after return or a rethrow.

  • Built-in error constructors: Error, TypeError, RangeError, ReferenceError, SyntaxError, and URIError; each instance has name, message, and stack.

  • throw accepts any value, but throwing an Error instance preserves the stack trace; rethrow with throw err inside catch when the error is not handled.

  • ReferenceError occurs when reading an undeclared identifier; TypeError occurs when calling a non-function or reading a property of undefined/null.

  • SyntaxError is thrown at parse time, so a try/catch around code in the same script cannot catch it; only eval or new Function defer parsing to runtime.

  • A try block requires either catch or finally; using try with neither is a SyntaxError.

  • Optional chaining obj?.prop and nullish coalescing obj ?? fallback prevent TypeErrors from null or undefined intermediate values.

  • console methods: log, warn, error, table, and time/timeEnd for measuring elapsed milliseconds; debugger pauses execution when developer tools are open.

  • Custom errors extend Error: class ValidationError extends Error { constructor(m){ super(m); this.name = 'ValidationError'; } }.