JavaScript

Object Properties

function DisplayPropertyNames(o){
        var names ="";
        for (var name in o) {
                names += name + " ";
        }
        alert(names);
}
DisplayPropertyNames(document)
//If o has property named "x" then set it
if ("x" in o) {
        o.x = 1;
 }

//If "x" exists and is not undefined, set it
if (o.x !== undefined) {
        o.x = 1;
 }

José M. Vidal .

33 of 65