Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. function flight(agent) {
  2. const city = agent.parameters['geo-city'];
  3. const time = agent.parameters['time'];
  4. const gotCity = city.length > 0;
  5. const gotTime = time.length > 0;
  6.  
  7. if(gotCity && gotTime) {
  8. agent.add(`Nice, you want to fly to ${city} at ${time}.`);
  9. } else if (gotCity && !gotTime) {
  10. agent.add('Let me know which time you want to fly');
  11. } else if (gotTime && !gotCity) {
  12. agent.add('Let me know which city you want to fly to');
  13. } else {
  14. agent.add('Let me know which city and time you want to fly');
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement