When i try to fill some innerHTML with a method of an object I got an issue. Strangely, reffering to a function works. But this second way isnt convenient for what I would like to do, that is why I ask for help. Is there a way to make this work ?
There is some code to explain my problem :
<html>
<body>
<div id = "content1"></div>
<div id = "content2"></div>
<script>
var object1 = { 'render' : () => { return 'a'; } }
var object2 = { 'render' : setContent() }
function setContent() { return 'b'; }
document.querySelector('#content1').innerHTML = object1.render; // Not working
document.querySelector('#content2').innerHTML = object2.render; // Working
</script>
</body>
</html>
And that is the render :
() => { return 'a'; }
b
Thanks a lot !!