I had a doubt.Is this possible to call one function/method present inside one class using object prototype in Javascript ? If possible then can anybody make the below code correct.
(function(){
window.Peer=function(){
var peer=this;
peer.getMessage=function(){
alert("hello!!! This is very good site.")
}
}
})();
<button type="button" id="btn">Click here</button>
<script>
document.getElementById('btn').onclick=function(){
Peer.prototype.getMessage();
}
The above code throwing error.Please give me some idea to resolve this.
Peer(getMessage())orPeer.call(getMessage())