Well whatta ya know. You are right. Change the line
if (!string)
into this
if (typeof string == 'undefined')
so that you get
window.$ = (query, ctx = document) => ctx.querySelector(query) window.$$ = (query, ctx = document) => ctx.querySelectorAll(query) HTMLElement.prototype.html = function (string) { if (typeof string == 'undefined') return this.innerHTML this.innerHTML = string return this } $('#test').html('');
codepen.io/jochemstoel/pen/OrJLbR
You can also replace it with
if(typeof string != 'string')
or even
if(string == undefined)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Well whatta ya know. You are right.
Change the line
into this
so that you get
codepen.io/jochemstoel/pen/OrJLbR
You can also replace it with
or even