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 trialBodie Wood
Full Stack JavaScript Techdegree Student 4,027 PointsSimple Solution
const difference = (low, high) => { return Math.floor(Math.random() * (high - low) + 1) + lower; }
const lowNum = prompt("Please enter a low number"); const highNum = prompt("Please enter a high number");
const userNum = difference(parseInt(lowNum), parseInt(highNum));
alert(${userNum} is between ${lowNum} and ${highNum}
);
1 Answer
Shem Ogweno
15,393 PointsI am not sure what is the question but working with what you have,
const difference = (low, high) => { return Math.floor(Math.random() * (high - low) + 1) + low; }
const lowNum = prompt("Please enter a low number");
const highNum = prompt("Please enter a high number");
const userNum = difference(parseInt(lowNum), parseInt(highNum));
alert(`${userNum} is between ${lowNum} and ${highNum}`);
Hope it help!
Shem Ogweno
15,393 PointsShem Ogweno
15,393 PointsHi Bodie Wood, what is lower in this line -> (high - low) + 1) + lower; and the last statement is missing back-tick -> alert(${userNum} is between ${lowNum} and ${highNum});