Colorful Blocky Background Thing

by Tgwizman

CSS

html, body {
    margin: 0px;
    padding: 0px;
    width: 100%;
    height: 100%;
    background-color: #999;
}

JavaScript

newBlock = function() {
    block = document.createElement('div');
    block.style.width = "20px";
    block.style.height = "20px";
    block.style.backgroundColor = rHex();
    document.body.attachChild(block);
};

rHex = function() {
    colors = "0123456789ABCDEF";
    function rC(){return colors.split("")[Math.floor(Math.random()*16)].split("")[0]}
    return "#" + rC + rC + rC;
};

console.log(rHex());
newBlock();