Page 49 - JavaScript
P. 49

console.log("%s, %s!", greet, who);


        This will log the following to the console:




















        Logging Objects



        Below we see the result of logging an object. This is often useful for logging JSON responses from
        API calls.


         console.log({
             'Email': '',
             'Groups': {},
             'Id': 33,
             'IsHiddenInUI': false,
             'IsSiteAdmin': false,
             'LoginName': 'i:0#.w|virtualdomain\\user2',
             'PrincipalType': 1,
             'Title': 'user2'
         });


        This will log the following to the console:





















        Logging HTML elements




        You have the ability to log any element which exists within the DOM. In this case we log the body
        element:


         console.log(document.body);




        https://riptutorial.com/                                                                                6
   44   45   46   47   48   49   50   51   52   53   54