function internals

by Terrance Smith

JavaScript

var showInfo = function (obj) {
    if (obj.length>0) {
        console.info("object has a length of "+obj.length);
        try {
            for (var member in obj) {
                console.info("member");
                console.info("Name=" + member + "|value:" + obj[member]);
            }
        } catch (e) {
            console.info(e);
        }
    } else {
        console.info("is undefined");
    }
};

var showInfoFor = function (obj) {
    if (obj.length>0) {
        var size = obj.length;
        console.info("object has a length of "+obj.length);
        try {
            for (var i=0;i<size;i++) {
                console.info("member");
                console.info("Name=" + obj[i] + "|value:" + obj[i].value);
            }
        } catch (e) {
            console.info(e);
        }
    } else {
        console.info("is undefined");
    }
};

function myFuncLiteral() {}
showInfo(Function);
showInfo(typeof Function);

//showInfo(myFuncLiteral);
//showInfo(function(){});
var a = function(){};
showInfoFor(a);
showInfoFor(a.prototype);
showInfoFor(myFuncLiteral);
showInfoFor(myFuncLiteral.prototype);
showInfoFor(typeof Function.prototype);