0 points

Leftpad: 11 lines of code that broke the internet in 2016


dashboard

Fri Dec 27 2019 19:07:08 GMT+0000 (UTC)

Posted by @bluespin223 #javascript #interesting #historicalcode #leftpad

module.exports = leftpad;
function leftpad (str, len, ch){
   str = String(str);
   var i = -1;
   if (!ch && ch !== 0) ch = ' ';
   len = len - str.length;
   while (++i < len){
      str = ch + str;
   }
   return str;
}
content_copy

This story will always fascinate me. How one programmer's fight for open source against a corporate takeover led to him deleting a package nobody knew about. It crashed any site that ran javascript. A package that had just 11 lines of code.

https://qz.com/646467/how-one-programmer-broke-the-internet-by-deleting-a-tiny-piece-of-code/

>> Browse more code snippets

@factsheet12345 - Sun Dec 29 2019 19:27:27 GMT+0000 (UTC)

It only "broke" for about 2 hours. Not as dramatic as the title suggests

more_vert