title: I cannot get object properties as function
body: <p>Halo guys.. I'm quite new here in this site, so any help would be appreciated. please let me know if my question already exists in another topic. i have the following problem.. i create an object which has another object. the child object has some properties. whenever i iterate the child object to get the properties, it seems all of the properties are of string type.. below are my codes:</p>
  
  <pre><code>    var obj = {}
      obj.x = function(){
          this.y = function(){
  
          }
      }
  
      for(var a in obj){
          alert(typeof(a) === "string"); //this will be true
          alert(a.hasOwnProperty("y")); //this will be false
      }
  </code></pre>
  
  <p>I use chrome to test this. shouldn't it be that typeof(a) === "function" is true and that a.hasOwnProperty("y") is also true?
  I cannot see my mistakes here. I'm quite lost.. any ideas?</p>