This is adapted from example 7-19 from The Book of JavaScript, by Dave Thau.

Number 1:
Number 2:
The Product: