Converting this interactive notebook to vanilla js

How can I convert this notebook into vanilla js?

Use a functional programing approach by changing cells into functions.