i learning object oriented javascript, object palyground
according tutorial, function considered object , know can properties of object using in keyword in javascript
var obj = {a:"hello",b=123}; for(var prop in obj) alert(var); the above code gives me keys present in function object obj expected
but when use same code situation
var funobj = function(a,b){ alert("hello"); } for(var prop in funobj) alert(prop); or in case even
function myfunction(a,b){ alert("hello"); } for(var prop in myfunction) alert(prop); it not give me output, ideally according tutorial function object should comprise of three properties are: name, length , prototype getting none, doing wrong
kindly me
where doing wrong
for...in iterates on enumerable properties. default properties of native objects non-enumerable.
you use object.getownpropertynames list of properties of function object:
> object.getownpropertynames(function() {}) ["length", "name", "arguments", "caller", "prototype"] or if want inspect properties learning purposes, use console.dir log function:

Comments
Post a Comment