top of page

JS Fundamentals: Reference Guide

Updated: Jul 1, 2025


Overview


This guide serves as a structured reference for JavaScript fundamentals, covering essential concepts from basic syntax to advanced patterns. Each section includes practical code examples and real-world applications, demonstrating both theoretical knowledge and hands-on implementation skills.

1. Environment Setup & Basic Output

Key Points:

  • console.log() is the primary debugging tool in JavaScript

  • Essential for development workflow and testing

  • Available in all JavaScript environments (browser, Node.js)


2. Variable Declaration & Scope Management


Modern Variable Declaration Patterns

Best Practices Demonstrated:

  • Prefer const for values that don't change

  • Use let for variables that need reassignment

  • Avoid var in modern JavaScript due to hoisting issues


3. Data Type System

Technical Notes:

  • JavaScript is dynamically typed - variables can hold any data type

  • Understanding type coercion is crucial for debugging

  • Null vs undefined distinction is important for conditional logic


4. String Manipulation Techniques


Concatenation vs Template Literals

Advantages of Template Literals:

  • Improved readability and maintainability

  • Support for multiline strings

  • Expression evaluation within ${}

  • Reduced concatenation errors


5. Object-Oriented Data Structures


Object Manipulation Patterns


Array Management


6. Comparison Operations & Type Safety

Professional Recommendation: Always use strict equality (===) to prevent unexpected type coercion bugs.


7. Logical Operations & Boolean Logic


8. Control Flow Implementation


Conditional Logic Structures

9. Iteration Patterns & Loop Constructs


Multiple Loop Implementations

Performance Notes:

  • for loops are fastest for simple iteration

  • forEach is more readable for array processing

  • for...of provides clean syntax for iterables


10. Function Design Patterns


Function Declaration Strategies

11. Module System & Code Organization


ES6 Module Patterns

Export Patterns (printHelper.js):


Import Patterns:

Class-Based Architecture

Alternative Pattern - Singleton Export:

12. Project Configuration


Package.json Configuration:

Key Configuration Notes:

  • "type": "module" enables ES6 import/export syntax

  • Proper package.json setup is essential for Node.js projects

  • Version control and dependency management considerations

 
 
bottom of page