Create javascript of baker's problem