Sock Hacking 101
Welcome, young hacker!
Lesson 1: Sock Sorting
Sort your socks by color, pattern, and material. It's not as hard as you think!
// Sort the socks in your drawer
// Color, pattern, material, and size matter
function sortSocks(socks) {
var color = [];
var pattern = [];
var material = [];
var size = [];
for each(var sock in socks) {
if (sock.color == "red" || sock.color == "blue" || sock.color == "green")
color.push(sock);
else if (sock.pattern == "stripes" || sock.pattern == "polka dots")
pattern.push(sock);
else if (sock.material == "cotton" || sock.material == "nylon")
material.push(sock);
else if (sock.size == "large" || sock.size == "small")
size.push(sock);
}
return [color, pattern, material, size];
}
Practice, practice, practice! You can't hack your way to a good sock collection without it!