slightly more functional -- js -- demo