Some changes;

Replaced IIFE and "return function";
Replaced "var silhouetteColor" with "context.fillStyle";
Replaced function drawLine with context.fillRect;
Changed basic sanity check to be "if (s)";
Removed allLineLengths array;
Changed canvas.width to be equal to window.innerWidth/2 (That should be
enough, but you can always change it to be equal to window.innerWidth);