Exercise 4 · Chapter: Pixel ProjectsOptional+50 XP
Gradient
Create a 10x10 grid that shows a gradient from black to blue!
Each row should use the same color. Row 0 is darkest (black), row 9 is brightest (blue).
Use hex colors! The format is "#0000XX" where XX is the blue intensity.
For row i, compute the blue value as i * 28 and build the color with "#0000" + blue.toString(16).padStart(2, "0").
Don't change the console.log statements at the bottom.
Expected output
10 #000000 #0000fc
Need a hint?
3 available · costs 5 XP each
javascript
let grid = [];
// Create a 10x10 gradient from black to blue
// Row i: blue value = i * 28
// Color: "#0000" + blue.toString(16).padStart(2, "0")
let __grid__ = grid;
// Don't change below this line
console.log(grid.length);
console.log(grid[0][0]);
console.log(grid[9][0]);
Output
Run your code to see the output here.