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 trialjara hernández Quijada
2,475 PointsI've solved it in another way, is it correct?
alert ("Let's do some maths!");
const numberOne = prompt ('Please, introduce a number');
const numberTwo = prompt ("Please, introduce one more number");
const message = `<h1>Math with the numbers ${numberOne} and ${numberTwo}</h1>
${numberOne} + ${numberTwo} = ${parseFloat(numberOne) + parseFloat(numberTwo)} <br>
${numberOne} * ${numberTwo} = ${parseFloat(numberOne) * parseFloat(numberTwo)} <br>
${numberOne} - ${numberTwo} = ${parseFloat(numberOne) - parseFloat(numberTwo)} <br>
${numberOne} / ${numberTwo} = ${parseFloat(numberOne) / parseFloat(numberTwo)} <br>
`;
document.write (message);
PS: hope the markdown worked... It's my first time trying to use it.
2 Answers
Steven Parker
231,141 PointsYou didn't provide a link to the "other way", but I'd guess it may have used concatenation instead of a template string?
If so, this would be functionally equivalent and equally valid. Good job.
jara hernández Quijada
2,475 PointsSorry Steve, can't you see my piece of code above? That was my code, using template strings!!
Steven Parker
231,141 PointsMy original answer was about your code as shown, I just wasn't sure what you were comparing to!
For future questions, consider providing a link to the course page you are referencing.
Steven Parker
231,141 Pointsjara hernández Quijada — Glad I could help. You can mark the question solved by choosing a "best answer".
And happy coding!
jara hernández Quijada
2,475 PointsOh, I understand! I was comparing mine to Gill's.
jara hernández Quijada
2,475 Pointsjara hernández Quijada
2,475 PointsIt worked!!!