Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
akash dikkaram
1,927 PointsIs My Code correct??
var html = ''; var red; var green; var blue; var rgbColor;
function color(){
return Math.floor(Math.random() * 256 );
}
for(var i=0;i<9;i++){
/*red = Math.floor(Math.random() * 256 );
green = Math.floor(Math.random() * 256 );
blue = Math.floor(Math.random() * 256 );*/
rgbColor = 'rgb(' + color() + ',' + color() + ',' + color() + ')';
html += '<div style="background-color:' + rgbColor + '"></div>';
}
document.write(html);
1 Answer
Matt Brock
28,330 PointsIs this what you're trying to do? Check out this pen I made on Codepen.
Dan Weru
48,030 PointsDan Weru
48,030 PointsHey Matt, that was really cool. I made an edit to it ... see https://codepen.io/weru/pen/rLKEbo
It looks much nicer. Anywho, I liked it.
Matt Brock
28,330 PointsMatt Brock
28,330 PointsCheers, Daniel!