Add member function : Member Function « Object Oriented « JavaScript Tutorial






<html>
<head>
<title>Example</title>
</head>
<body>
<script type="text/javascript">
function myObj() {
    alert("hi");
}

myObj.alternate = function() {
    alert("hola");
};

myObj();
myObj.alternate();

</script>

</body>
</html>








25.4.Member Function
25.4.1.Defining the object methods outside of the factory functions and then pointing to them
25.4.2.Create an Object with member method
25.4.3.Add member function
25.4.4.Adding method to a class using prototype
25.4.5.Custom objects and associative object arrays
25.4.6.Instance method
25.4.7.Call object member function