I am writing two type of code in javascript one is with function declaration and one with function expression i just wrote first with function declaration for createDrinkorder function and second one with function expression and the problem i am facing is that i am getting correct output for function declaration but error with function expression and according to javascript rules i can use both function declaration and function expression but when i try to do the task with function expression i am getting error that createDrinkorder is not a function 

below is my code for that 

```js
var passengers = [{
    name: "Jane Doloop",
    paid: true,
    ticket: "coach"
  },
  {
    name: "Dr. Evel",
    paid: true,
    ticket: "firstclass"
  },
  {
    name: "Sue Property",
    paid: false,
    ticket: "firstclass"
  },
  {
    name: "John Funcall",
    paid: true,
    ticket: "coach"
  }
];

function servePassengers(passengers) {
  for (var i = 0; i < passengers.length; i++) {
    serveCustomer(passengers[i]);
  }
}
servePassengers(passengers);

function createDrinkOrder(passenger) {
  if (passenger.ticket === "firstclass") {
    document.write("Would you like a cocktail or wine?" + "<br>");
  } else {
    document.write("Your choice is cola or water." + "<br>");
  }
}

function serveCustomer(passenger) {
  createDrinkOrder(passenger);
  createDrinkOrder(passenger);
}

```

and this is code for function expression

```js
var passengers = [{
    name: "Jane Doloop",
    paid: true,
    ticket: "coach"
  },
  {
    name: "Dr. Evel",
    paid: true,
    ticket: "firstclass"
  },
  {
    name: "Sue Property",
    paid: false,
    ticket: "firstclass"
  },
  {
    name: "John Funcall",
    paid: true,
    ticket: "coach"
  }
];

function servePassengers(passengers) {
  for (var i = 0; i < passengers.length; i++) {
    serveCustomer(passengers[i]);
  }
}
servePassengers(passengers);
var createDrinkOrder = function(passenger) {
  if (passenger.ticket === "firstclass") {
    document.write("Would you like a cocktail or wine?" + "<br>");
  } else {
    document.write("Your choice is cola or water." + "<br>");
  }
}

function serveCustomer(passenger) {
  createDrinkOrder(passenger);
  createDrinkOrder(passenger);
}

```