javascript - Use a method in a callback -


question being edited. sorry changes. please don't provide answers @ moment :)

if declare object in javascript:

var myobject = {  function myfunction() {     console.log('hi!');   } }  

why errors?

wouldn't rather be:

var myobject = {     myfunction : function(){         console.log('hi!');     } } 

how call method:

myobject.myfunction() 

Comments

Popular posts from this blog

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

javascript - return highlighted cells to php -

java - Creating a room by reading from a file (for a game) -