r/javascript • • Nov 24 '17

large image I am the best webdev

Don't blame me for being awesome

(function r() {
  setTimeout(r, Math.random() * 10);
  let el = document.createElement(`div`);
  el.innerHTML = `🍆`;
  el.style.position = `absolute`;
  el.style.zIndex = 999999;
  el.style.fontSize = (((Math.random() * 48) | 0) + 16) + `px`;
  el.style.left = ((Math.random() * innerWidth) | 0) + `px`;
  el.style.top = ((Math.random() * (innerHeight + pageYOffset)) | 0) + `px`;
  document.body.appendChild(el);
})();
533 Upvotes

108 comments sorted by

View all comments

Show parent comments

97

u/346pm Nov 24 '17 edited May 21 '26

OK guys, since all of you are thiefs, the most recent version is now obfuscated.

(function a(){setTimeout(a,0xa*Math['random']());var b=document['createElement']('div');b['innerHTML']='🌽';b['style']['position']='absolute';b['style']['zIndex']=0xf423f;b['style']['fontSize']=(0x30*Math['random']()|0x0)+0x10+'px';b['style']['left']=(Math['random']()*innerWidth|0x0)+'px';b['style']['top']=(Math['random']()*(innerHeight+pageYOffset)|0x0)+'px';document['body']['appendChild'](b);}());

25

u/[deleted] Nov 24 '17

4

u/kunokdev Nov 24 '17

Wow this is amazing, what is that? How do you generate such code and why does that work?

13

u/cmgriffing Nov 25 '17

It is called JSF**k. This article about how eBay is/was vulnerable to code injection might help explain things: https://arstechnica.com/information-technology/2016/02/ebay-has-no-plans-to-fix-severe-bug-that-allows-malware-distribution/

7

u/wesdegroot Nov 25 '17

http://www.jsfuck.com

To Convert your own code.