understanding Extend .

understanding Extend .

I got this example from the Jquery Docs , for the extend function : 

  1. var defaults = { validate: false, limit: 5, name: "foo" };
  2.              var options = { validate: true, name: "bar" };
  3.              // Merge defaults and options, without modifying defaults
  4.              var settings = $.extend( {}, defaults, options );
  5.              var printObj = typeof JSON !== "undefined" ? JSON.stringify : function( obj ) {

  6.              var arr = [];
  7.              $.each( obj, function( key, val ) {
  8.              var next = key + ": ";
  9.              next += $.isPlainObject( val ) ? printObj( val ) : val;
  10.              arr.push( next );
  11.              });
  12.              return "{ " + arr.join( ", " ) + " }";
  13.              };
  14.              $( "#log" ).append( "defaults -- " + printObj( defaults ) + "" );
  15.              $( "#log" ).append( "options -- " + printObj( options ) + "" );
  16.              $( "#log" ).append( "settings -- " + printObj( settings ) + "" );

on line 6 is the function ever being called ? i mean does the ternary operator ever evaluate to false ?? 
i did a console.log('function called'); inside the function and did't get any console.logs

also please have a look at line 6 again : 

  1. var printObj = typeof JSON !== "undefined" ? JSON.stringify : function( obj ) {
if u were a english teacher ,teaching Jquery how would the above statement really read out ? 

"check printObj" if it is a a JSON type if it is than JSON.stringify it , else execute the function . 

now a few more supplemetary but important questions : 

is't JSON.stringify suppose to be taking an argument ?? 


now i call printObj like this : 

  1.  $( "#log" ).append( "defaults -- " + printObj( defaults ) + "" );

going back to line 6 , specifically the below line 

  1. typeof JSON !== "undefined"

what am i checking here ?? 

if printObj itself is typeof JSON ??

or defaults is typeof JSON ??

the confusion continues as i read line 6 ahead : 

  1. JSON.stringify

now JSON.stringify what ?? 

if printObj itself is typeof JSON ??

or defaults is typeof JSON ??