Is it like...
var obj = new Object(); obj.function1 = function(){ //code }
or something like that?
With es6 you can do it like this:
var a = { func(){ return 'The value'; } } document.getElementById('out').innerHTML = a.func();