René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

in [JavaScript snippet]

function xyz(o) {

  for (var k in o) {
    if (typeof (o[k]) == 'object') {
      txt_out(k + '--+')
      xyz(o[k])
    }
    else {
      txt_out(k + ": " + o[k])
    }
  }
}

function main() {

  var thingies = {cities : {Berne : 'Switzerland',
                            Berlin: 'Germany',
                            Rome  : 'Italy',
                           },
                  fruits : {lemon : 'Yellow',
                            banana: 'Yellow',
                            dat   : 'Brown',
                           },
                  42     : 'fourty-two',
                 }

// txt_out(thingies.cities.Berlin) 

  if ("Berlin" in thingies.cities) {
    txt_out("Berlin is in cities")
  }
  else {
    txt_out("Berlin is not in cities")
  }

  if ("Berlin" in thingies) {
    txt_out("Berlin is in thingies")
  }
  else {
    txt_out("Berlin is not in thingies")
  }


  // ---


  xyz(thingies)


}