Skip to content

khawla-14/javascript-fundamentals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Fundamentals Training

This repository contains a comprehensive set of notes, code examples, and mini-projects designed to teach fundamental JavaScript concepts, focusing heavily on DOM manipulation and API interaction. It's structured as a progressive learning path, building from basic syntax to more advanced asynchronous operations.

Target Audience

This material is ideal for:

  • Beginners who are just starting their journey with JavaScript.
  • Web Developers looking to solidify their understanding of core JavaScript concepts and browser interaction.
  • Anyone seeking a practical, hands-on approach to learning modern JavaScript.

What You Will Learn

This training covers a wide range of essential JavaScript topics, including:

Session 1: Introduction to JavaScript & DOM Manipulation (Foundations)

This session lays the groundwork for understanding how JavaScript interacts with web pages.

  • The document Object: How JavaScript represents your HTML page.
  • Selecting Elements: Using querySelector() to target specific HTML elements.
  • Event Handling: Making your pages interactive with addEventListener() (e.g., clicks, inputs, hovers).
  • Manipulating Content: Reading and changing text (.textContent) and styles (.style).
  • Basic Element Interaction: Creating a button that changes text and style on click.
  • Debugging: Utilizing console.log() effectively.

Session 2: Data Types, Functions, Arrays, and Advanced DOM

Building on the basics, this session dives into core JavaScript programming constructs and more dynamic DOM interactions.

  • Data Types & Type Coercion: Understanding JavaScript's loosely typed nature and automatic type conversions ("5" + 5 vs. "5" - 5).
  • Strict vs. Loose Equality: The difference between == and ===.
  • Handling User Input: Converting string input values to numbers (Number(), parseInt()).
  • Functions:
    • Declaration, expression, and modern Arrow Functions (ES6).
    • Using functions to refactor and make code reusable with DOM manipulation.
  • Arrays: Storing collections of data.
  • Dynamic DOM Manipulation:
    • createElement(): Creating new HTML elements dynamically.
    • appendChild(): Adding elements to the webpage.
    • remove() / removeChild(): Deleting elements.
    • Modifying Attributes & Classes: setAttribute(), getAttribute(), classList.add(), classList.remove(), classList.toggle().
  • Object Manipulation:
    • Creating and accessing properties of JavaScript objects.
    • Working with Arrays of Objects for structured data.
    • Mini-Project: Displaying User Cards dynamically.
  • The Event Object: Accessing event details (e.g., event.target, event.preventDefault()).
  • Template Literals (ES6): Modern way to create strings with embedded expressions (``).
  • Essential Array Methods: forEach, map, filter, find, some, every.
  • Mini-Project: Product Filter/Search (combining arrays, events, DOM).
  • Homework: Build a Simple Expense Tracker (Add, Display, Filter, Total, Delete).

Session 3: Asynchronous JavaScript & API Interaction

This session introduces how JavaScript communicates with external services, a cornerstone of modern web development.

  • What is an API? Understanding Application Programming Interfaces conceptually (the "waiter" analogy).
  • JSON (JavaScript Object Notation):
    • The standard data format for APIs.
    • JSON.parse(): Converting JSON strings to JavaScript objects.
    • JSON.stringify(): Converting JavaScript objects to JSON strings.
  • Fetch API: The modern way to make network requests.
    • async/await: Handling asynchronous operations gracefully.
    • Making GET requests to retrieve data.
  • Mini-Project 1: Display Users from API: Fetching and rendering user data.
  • Error Handling: Using try...catch blocks and checking response.ok for robust code.
  • Mini-Project 2: Posts Viewer: Fetching and displaying blog post data.
  • Sending Data (POST Requests):
    • Configuring fetch() for POST requests (method, headers, body).
  • Mini-Project 3: Create Post Form: Submitting new data to an API.
  • Final Project: Weather App: A comprehensive project integrating all learned concepts (API key setup, display, error handling, loading states).
  • Homework: Build a Random User Generator (fetch user profiles, display details, loading, error handling, bonus for multiple users).

Key Concepts Summary

By the end of this training, you will have a solid grasp of:

  • ✅ Core JavaScript syntax and data structures
  • ✅ Effective DOM manipulation for interactive web pages
  • ✅ Handling user events and input
  • ✅ Using functions and array methods for efficient coding
  • ✅ Understanding and working with APIs
  • async/await for asynchronous operations
  • ✅ JSON data format and conversion
  • ✅ Implementing robust error handling
  • ✅ Building real-world interactive web components

How to Use This Repository

Each session's code examples and mini-projects are organized to follow the learning progression. You can:

  1. Clone the repository: git clone <repository-url>
  2. Navigate to session folders: Explore the JavaScript files (.js) and corresponding HTML files (.html) (if applicable) for each part.
  3. Open HTML files in your browser: To see the DOM manipulation and API examples in action.
  4. Experiment: Modify the code, try out the exercises, and build your own small projects!

About

JavaScript fundamentals with DOM examples and mini projects

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors