E-commerce Cart Logic Exercises
A basic JavaScript logic exercise focused on e-commerce cart calculations.
This project practices arrays, objects, loops, conditions and basic business logic implementation.
This project was created during Module M2 of the Epicode course.
Features
ยท
Usage
ยท
Report a bug
ยท
Request a feature
๐งญ Table of Contents
๐ Features
- Cart total calculation
- Sum of product prices from an array
- Final cart total generation
- Shipping cost handling
- Ambassador discount logic
- Users have an
isAmbassador property
- Ambassador users receive a 30% discount
- Discount is applied before shipping calculation
- Shipping rules
- Free shipping for carts above 100
- Fixed shipping cost added when the threshold is not reached
- Users array management
- Creation of user objects
- Population of the main users array with
.push()
- Loop through all users to print custom messages
- Filtered ambassadors array
- Creation of a second array containing only ambassador users
- Filtering logic performed through iteration and conditional checks
- Console-based output
- The exercise prints cart results and user status messages in the console
- Useful for understanding program flow and logic validation
- Educational Context
- Built as a JavaScript practice exercise to improve confidence with arrays, objects, loops and conditions
๐งฑ Tech Stack
๐ Project Structure
```bash
.
โโโ inde.html
โโโ S2P2-scaricabile.js
โโโ README.md