setContentFromObject
to show
Chuck Norris
jokes
I invented a very practical and simple to use method:
setContentFromObject(
obj
)
.
You simple feed it with an
object
and it will
spread out
the
properties
to
DOM
elements which have “told” that they want to use a property.
To get the value of a
property
named "
joke
" to a
H1
tag you simply write this:
<h1 data-joke><h1>
and by default
innerText
will be set to that property.
Jokes from https://api.icndb.com/jokes/random
<small data-joke="">
</small>