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
ziaul sarker
3,652 Pointsfunction
function num (num1, num2) {
if (num1 > num2) {
alert("number 1 is larger " + num1);
Document.write("number 1 is larger " + num1);
console.log("number 1 is larger " + num1);
}
else if (num1 < num2) {
alert("number 2 is larger " + num2);
Document.write("number 2 is larger " + num2);
console.log("number 2 is larger " + num2);
}
}
}
num ((Math.floor(Math.random() * 100) + 1), (Math.floor(Math.random() * 100) + 1))
1 Answer
jason phillips
18,131 PointsYou have an extra curly bracket and "Document.write needs to be document.write"
function num (num1, num2) {
if (num1 > num2) {
alert("number 1 is larger " + num1);
document.write("number 1 is larger " + num1);
console.log("number 1 is larger " + num1);
}
else if (num1 < num2) {
alert("number 2 is larger " + num2);
document.write("number 2 is larger " + num2);
console.log("number 2 is larger " + num2);
}
}
num ((Math.floor(Math.random() * 100) + 1), (Math.floor(Math.random() * 100) + 1));
ziaul sarker
3,652 Pointsziaul sarker
3,652 Pointsthanks a lot @jason phillips you are the man.