Search code examples
javascriptnode.jswebdriver-io

How to know the object value in Java Script


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 ?


Solution

  • 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.