Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Calling method of object

I have the following object:

​var x = {
 y: '33', 
 z: '88', 
 m: function() {
 alert('this is the m element');
 }
};
x.newObject = function() {
 alert('mm'); 
 function click(myval) {
 alert('you have select the click function' + myval); 
 }
};
x.newObject.click('clickme'); ​​​​​​​​​// This is what I have tried; it's not working. 

How can I call the click function of newObject?

jsFiddle

Answer*

Draft saved
Draft discarded
Cancel

lang-js

AltStyle によって変換されたページ (->オリジナル) /