The intention of this exercise is to give you more experience working with collections and loops in JavaScript.
- Using Visual Studio Code, open the folder
flexpath-modules-code-formatting-intro-to-unit-testing-exerciseswherever you saved it on your device. - Then open the
flexpath-modules-code-formatting-intro-to-unit-testing-exercises/exercisesfolder. Inside are a collection of folders for each exercise. Exercise instructions are provided to you in .txt files in these folders. - To test your code, you will open up your terminal, and navigate to the specific
exercise_[number]folder inside of the largerexercises/folder where you are working in, using the change directory commandcd. - You will then run the command
node [filename].jsto run whichever file in the folder you are working with, replacing[filename]in the command with the file's actual name.
Exercise solutions are in the /solution folder
-
Modules:
- Understanding ECMAScript Modules (ESM) and CommonJS.
- Using
importandexportfor ESM andrequirefor CommonJS. - Organizing code into separate files and exporting/importing functions and variables.
-
Package Management:
- Introduction to Node Package Manager (npm) and managing third-party packages.
- Creating and configuring
package.jsonusingnpm init. - Installing, managing, and using third-party libraries like
chalk.
-
File System and Relational Databases:
- Using Node.js to interact with the file system, including reading and writing files.
- Introduction to relational databases using SQLite and connecting with JavaScript using third-party libraries.
- Migrating data storage from JSON files to a relational database.
-
Linting and Code Style:
- Introduction to ESLint for code linting and enforcing style rules.
- Configuring ESLint in a project and using prebuilt configurations like Airbnb’s style guide.
- Automatically fixing linting errors and integrating ESLint into the development workflow.
-
Unit Testing:
- Introduction to unit testing and testing frameworks like Jest.
- Writing and running unit tests to ensure code functionality and quality.
- Understanding code coverage and its importance in testing.