Make something small, make it good
One button. Every click sets a new random background colour and shows the colour code. Make it look good.
Pick one of two problems below. We grade how you think, not what the model typed.
One button. Every click sets a new random background colour and shows the colour code. Make it look good.
The file below runs clean and prints numbers you shouldn't trust. Find what's wrong, fix it, say how you knew.
Three numbers come out. Two are provably wrong. The third depends on what "top selling" means — tell us what you'd ask before changing it.
// orders.js — today's order summary.
// It runs clean. Do not trust what it prints.
const orders = [
{ id: 1, item: "Keyboard", qty: 2, price: 1200, status: "paid" },
{ id: 2, item: "Mouse", qty: 1, price: 650, status: "cancelled" },
{ id: 3, item: "Monitor", qty: 1, price: 9800, status: "paid" },
{ id: 4, item: "USB Cable", qty: 3, price: 199, status: "paid" },
{ id: 5, item: "Headset", qty: 1, price: 2400, status: "refunded" },
];
function totalRevenue(orders) {
let total = 0;
for (let i = 1; i < orders.length; i++) {
total += orders[i].price;
}
return total;
}
function averageOrderValue(orders) {
return totalRevenue(orders) / orders.length;
}
function topSellingItem(orders) {
let best = orders[0];
for (const o of orders) {
if (o.price > best.price) best = o;
}
return best.item;
}
console.log("Revenue:", totalRevenue(orders));
console.log("Average:", averageOrderValue(orders));
console.log("Top item:", topSellingItem(orders));
30 minutes. Not timed, but it shows.
One exercise. A or B, not both.
Any AI tool. Nothing to disclose.
No libraries. Plain HTML, CSS, JS.
It must run. Double-click, it works.
Public repo. One file, one README.
Three README lines. What you'd fix next.
Unfinished is fine. Say where you got stuck.
Does the code do what you think it does?
Spotting a wrong answer that runs clean.
Empty input, refresh, 360px, double click.
Did you stop at the model's first output?
What you overrode, not what you asked for.
Ten minutes, your screen, no tool open.
Swap Choice A for Choice B if you took the debugging one. No CV needed.