Please enable JavaScript to use CodeHS

Box of Chocolates

This JavaScript Graphics project has students walk through the creation of a box of chocolates, step by step. Students will make use of functions with parameters, loops, if statements, and mouse events.

Hard

4 Hours

High School

Project Description

Background

What better way to celebrate Valentine’s Day than with some chocolate? Chocolates are a popular gift for Valentine’s Day because they are delicious and can be enjoyed by people of all ages.

Your Task

You will be writing a program that generates a box of chocolates on the canvas! You will choose what your box looks like as well as what chocolates will be inside. Once you finish creating your box and chocolates, you will be adding the ability to remove the lid from the box so we can see all of the chocolates inside!

Run the example program a few times and note the differences in the chocolates!

Project Demo

Explore this program before assigning it!

Project Overview

Here is an outline of the project activities: