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

php - Passing multiple values in a url using checkbox -

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

sql - Postgresql tables exists, but getting "relation does not exist" when querying -