-1

HI can i able to print the 'bookingPreferences' value in the console ?

let bookingPreferences = {
      destination: hotel.ancestorDestination.name.toLowerCase (),
      destinationId: hotel.ancestorDestination.shortId,
      checkInDate: new moment ().add (dateCount, (dateScale.includes ('month') ? 'months' : 'days')).format ('YYYY-MM-DD'),
      checkOutDate: new moment ().add (dateCount, (dateScale.includes ('month') ? 'months' : 'days')).add (6, 'days').format ('YYYY-MM-DD'),

      partyMix: {
        adultCount: 1,
        childCount: 0,
        nonAdultAges: []
      },
      resortId: hotel.id
    };

i have tried with var value= JSON.stringify ('bookingPreferences' + bookingPreferences);

which was not helpful . kindly let me know what is the way to know the value nested object value ?

swagatika
  • 61
  • 1
  • 2
  • 8
  • 1
    What do you mean by **'bookingPreferences' value**? Can you be more specific? You can easily print an object in the console by `console.log(bookingPreferences)` – Rüzgar Jul 25 '21 at 18:21
  • Does this answer your question? [How can I display a JavaScript object?](https://stackoverflow.com/questions/957537/how-can-i-display-a-javascript-object) – Aleksandr Smyshliaev Jul 25 '21 at 18:23
  • bookingPreferences is a variable which value i want to print – swagatika Jul 25 '21 at 18:23
  • 1
    `console.log(bookingPreferences)` – Kinglish Jul 25 '21 at 18:25
  • Then go with `console.log(bookingPreferences)` Is there a problem with that? If so it may relate to other issues like where on your code you are trying to print. Maybe before the object is declared, or a possible AJAX issue. – Rüzgar Jul 25 '21 at 18:26
  • i have tried with console.log(bookingPreferences) which is displaying me as [Object, Object] – swagatika Jul 25 '21 at 18:34

1 Answers1

1

You need to import the hotel object you are passing into your bookingPreferences. Then a simple console.log(bookingPreferences) will do the trick for you.