G9.js is a JavaScript library that allows users to create interactive graphics by defining initial data and a render function. The library optimizes over the space of possible values for the data to find a set of values that comes closest to creating the desired change when a user interacts with the graphics. This enables users to create complex, interactive demos without explicitly coding the interactivity. The library is demonstrated through various examples, including a LOGO Turtle simulator and a crank and piston animation.