Vanilla JavaScript Projects

Anjana Vakil

Anjana Vakil

Software Engineer & Educator
9 hours CC
Vanilla JavaScript Projects

Course Description

Solidify your JavaScript fundamentals through practical projects! Tackle real-world tasks like implementing a dark mode switcher, creating a modal dialog component, and pull everything together into a full camera app. Throughout the course, you'll use asynchronous JavaScript, the DOM, and take JavaScript beyond the browser with Node.js. Use modern JavaScript tooling and GitHub Actions to deploy your app to the real world!

This course and others like it are available as part of our Frontend Masters video subscription.


Course Details

Published: February 12, 2024

Learn Straight from the Experts Who Shape the Modern Web

Your Path to Senior Developer and Beyond
  • 200+ In-depth courses
  • 18 Learning Paths
  • Industry Leading Experts
  • Live Interactive Workshops
Get Unlimited Access Now

Table of Contents


Section Duration: 10 minutes
  • Introduction
    Anjana Vakil introduces the course and explains that it will cover more advanced features of JavaScript, functional programming, object-oriented programming, and working with browser APIs. Several projects will be created throughout the course to practice and reinforce the advanced concepts presented.


Section Duration: 1 hour, 35 minutes

Object Oriented Programming

Section Duration: 54 minutes
  • Functions
    Anjana discusses functions in JavaScript and explains how they can be used as first-class data. Higher-order functions are introduced, and an example of creating a higher-order logging function is shared.
  • Scope & Closure
    Anjana explains the scope in JavaScript. Closure, where a function can "remember" values from its parent scope, is also discussed. Understanding these concepts can help developers avoid unexpected behavior in code.
  • Functional & Object Oriented Programming
    Anjana discusses two programming paradigms: functional programming (FP) and object-oriented programming (OOP). Examples of both paradigms are shared and the benefits of writing code using a functional style are explained.
  • IFFEs & Functional Q&A
    Anjana demonstrates Immediately Invoked Function Expressions (IIFE) in JavaScript. When using an IIFE, the function is evaluated and invoked immediately without needing a separate function call. They can be helpful in certain situations, such as when working with async and await in JavaScript. Pure functions in functional programming are also discussed.
  • Object prototype
    Anjana explains that every object in JavaScript has a prototype. Prototypes are the mechanism by which JavaScript objects inherit features from one another. The prototype chain can be followed to examine an object's inheritance.
  • Object hasOwnProperty
    Anjana demonstrates how to access properties and methods from an object's prototype. The hasOwnProperty method can determine if a property belongs to the object or if it's inherited through the prototype chain.


Section Duration: 20 minutes
  • Iterable Objects
    Anjana defines the requirements for an object to be iterable. There are many ways to iterate over objects, such as using map, for of/in loops, filter, and forEach. An object becomes iterable by implementing the iterator and the next methods on the returned object.
  • Generators
    Anjana compares iterable objects with generator functions. The yield keyword in generator functions allows the function to pause and resume execution. Generator functions can be used to implement iterables, and an example of using a generator as an iterator in a for-of loop is shared.
  • Date & Iterators Summary
    Anjana discusses the limitations and problems with the JavaScript Date object and mentions that the TC39 standards body is working on a new alternative to address these issues. A few additional examples of iterable objects in JavaScript are also shared.

Classes & Browser APIs

Section Duration: 1 hour, 23 minutes

JavaScript Outside the Browser

Section Duration: 41 minutes
  • Introduction to Node.js
    Anjana introduces Node.js as a way to run JavaScript outside of the browser. Developers can write JavaScript that runs server-side or in the command line. While some APIs are similar, Node-based applications can access system-level resources and other APIs not available in the browser. The Node.js REPL (Read-Evaluate-Print Loop) is also demonstrated in this lesson.
  • Running Node Scripts
    Anjana demonstrates how to run JavaScript in a JS file by creating a file and executing it with the `node` command. Differences between browser and Node JavaScript APIs are also discussed in this lesson.
  • Node Packages & npm
    Anjana introduces npm, a tool for installing and managing Node modules in a project. npm is similar to other package managers like Yarn or pnpm. Node modules can be explored in the online registry at
  • Creating a Node Package
    Anjana creates a new npm package using the npm command line tool. A default package.json file contains the details about the module and scripts available for running, testing, and building the project.
  • Creating Custom Scripts
    Anjana modifies the package.json file to create a new custom npm script. Custom scripts are key-value pairs. The key is the script's name, and the values are the commands to run. Scripts are executed with npm on the command line.
  • Installing Dependencies
    Anjana demonstrates how to add third-party dependencies to a project with the `npm install` command. Packages are downloaded from the npm registry and installed in a node_modules directory. Any dependencies of these packages are also installed.

Modern JavaScript Development

Section Duration: 1 hour, 54 minutes
  • Importing Modules
    Anjana introduces JavaScript modules and compares the CommonJS and ECMAScript syntax. When a module is imported, Node looks to see if that module is installed globally or locally in the node_modules directory.
  • Using Modules
    Anjana explains how modules can be used in a browser or Node.js applications. Browser-based applications must use the type="module" attribute on a script block. In Node.js applications, modules either need an `mjs` extension or have type="module" specified in the package.json file.
  • Evolution of JS Tooling
    Anjana discusses the history of JavaScript tooling and shares some advice for creating a balance between understanding the overwhelming amount of tools available today and choosing the right tools for your project.
  • Introduction to Vite
    Anjana introduces Vite and explains why it's a valuable build tool for JavaScript developers. Vite is widely used and provides several of the necessary tools like a development server, code bundling, and a robust set of plugins.
  • Creating a Vite Project
    Anjana uses the create-vite command-line tool to scaffold a new Vite project. The tool asks a few questions about the type of project and adds the necessary dependencies to the package.json file. The dependencies are installed after the project is created and the development server is started.
  • Exploring the Vite Project Code
    Anjana walks through the project structure and explores the generated files. Another benefit of the Vite development server is live reload, which automatically updates the application when changes are made to the source code.
  • Vite Selfie Cam Project
    Anjana explains the Selfie Cam project, which will display video from the user's webcam in a canvas element on the page. The project will use the getUserMedia API to access the webcam and the Canvas API to draw the image to the page.
  • Using the Canvas API
    Anjana uses the Canvas API to create a graphic similar to the JavaScript logo. A yellow rectangle is drawn to the canvas element. Then, the fill color is changed to black, and the fillText method is used to draw text on the yellow background.
  • Accessing the Camera
    Anjana begins building the selfie cam functionality. The existing application is refactored to use the getUserMedia API and add the video to a canvas element. The markup rendered by the main.js file is moved into the index.html file.
  • Refactoring the UI
    Anjana refactors the UI of the selfie cam projects so the logos appear above the space where the camera image will show. The getVideo method is exported as a module and imported into the main.js file.
  • drawVideo Method
    Anjana creates a drawVideo method that takes in a video and canvas element from the application. The method will draw the video image on the supplied canvas element. The drawVideo method is exported from the camera.js file so it can be imported and used in the application.
  • Using the Video Element
    Anjana uses the exported functions from the camera.js module to display an image from the camera on the web page. The code is refactored, so the image will be displayed once the user clicks the button.
  • Scaling the Canvas
    Anjana adjusts the image displayed in the canvas element so the size matches the image from the camera. The final solution can be found in the GitHub repository linked below.
  • Building for Production
    Anjana demonstrates how to build a production version of the application. Vite will provide errors when JavaScript features incompatible with the targeted browser runtime are used. An IIFE is used to enable support for top-level await.

Source Control, Linting, & Formatting

Section Duration: 36 minutes
  • Tooling Setup for Hackathon
    Anjana introduces the "hackathon" and explains how the quick win projects from earlier in the course will be combined into an application and deployed. GitHub is also introduced and will provide source control for the project.
  • ESLint
    Anjana installs and configures ESLint to check the source code for syntax errors and other code problems. A "lint" script is added to the package.json file, and the lint script is also run any time the build script is run. The code in the selfie-cam repo linked below can be used as a starting point for this lesson.
  • Prettier
    Anjana installs another developer tool, Prettier, responsible for consistent code formatting in a project. Prettier ensures any developers contributing to a project follow the same set of formatting rules.
  • VS Code Tooling
    Anjana demonstrates the tooling provided by Visual Studio Code to aid developers in their workflow. The Source Control panel provides a basic UI for git-related operations. Extensions for ESLint and Prettier are also shared.


Section Duration: 1 hour, 16 minutes
  • Deployment & Configuring Vite
    Anjana compares development and production environments and shares an example vite.config.js file containing configuration for both environments. Static hosting options are also discussed in this lesson, including GitHub Pages, Netlify, and Vercel.
  • Configuring GitHub Actions
    Anjana looks at the configuration options for deploying a project using GitHub Pages. The finished selfie-cam repo is used as an example. Adding a YAML file to a repo's .github/workflows folder allows developers to configure custom GitHub actions for any automation tasks, including deploying a Vite project to GitHub pages. The code in the selfie-cam project linked below can be used as a starting point for this lesson.
  • Viewing GitHub Actions
    Anjana looks at existing GitHub actions in the project and walks through each step displayed in the log. A successful action will have a green confirmation when it's completed. Failed actions are shown in red, and inspecting the logs helps developers understand why the action failed.
  • Project Code Tour: Modal and Form
    Anjana walks through the final Meme Me application, which contains elements from the quick-win projects earlier in the course and the selfie cam module. The Modal component is reused multiple times in this project. The Form module is also explored.
  • Project Code Tour: Camera and Text
    Anjana continues exploring the Meme Me application. The camera module has additional functionality using setInterval to continuously update the camera image, simulating a live camera feed. A Text module has been added to draw the meme text on a separate canvas, making it more flexible when the text is updated.
  • Hackathon: Fork the Project
    Anjana challenges students to fork the Meme Me application and add their own customizations. The customized project can then be deployed to GitHub pages. Code for the hackathon and detailed instructions for deployment can be found in the repo linked below.
  • Community Projects
    Anjana shares a few projects submitted by users during the course. If you would like to showcase your project, share a link in our Discord.
  • Q&A
    Anjana answers questions about how junior developers can continue to grow their skills and shares some advice for career transitions.

Wrapping Up

Section Duration: 7 minutes

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now