# NextPeer JavaScript Notes ## Values and variables Use const when the variable binding should not be reassigned; use let when reassignment is needed. Objects stored in const can still be mutated. Learn strings, numbers, booleans, null and undefined. ## Functions Describe a function's inputs, output and side effects. Prefer small functions you can test with clear examples. ## Collections Arrays represent ordered values. Objects represent properties. Practise map for transformation, filter for selection and reduce for accumulation. Check whether a method mutates the original array. ## Equality and missing values Understand strict equality and type conversion. Check missing values explicitly when zero or an empty string is a valid input. ## Async work A promise represents work that may complete later. async / await supports reading promise-based code in sequence. Handle rejected promises and show useful error messages. ## Browser interactions Read form inputs, validate them and respond to events. Use textContent for untrusted text rather than inserting it as HTML. Keep API secrets out of client-side code. ## Practice 1. Count word frequencies in a sentence. 2. Filter a product list by price. 3. Calculate a total from an array of quantities and prices. 4. Build a form with required-field messages. 5. Fetch sample data and handle loading, success, empty and error states. ## Review checklist Check types, null values, accidental mutation, unhandled promises and repeated submissions. Explain your code without reading a tutorial.