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

JavaScript The Solution

My solutions different but works lol

const start = alert('Lets do some math!');

let userFirstNum = prompt('Type a number that you want to add, subtract, multiple, and divide..');

let userSecondNum = prompt('Type another number to add, subtract, multiple, and divide from..');

let main = document.querySelector('body'); let message;

userFirstNum = parseFloat(userFirstNum); userSecondNum = parseFloat(userSecondNum);

function calculate(first, second) { let add = first + second; let subtract = first - second; let multi = first * second; let divide = first / second;

let addMessage = <li>${first} + ${second} = ${add}</li>; let subMessage = <li>${first} - ${second} = ${subtract}</li>; let multiMessage = <li>${first} * ${second} = ${multi}</li>; let divideMessage = <li>${first} / ${second} = ${divide}</li>;

message = addMessage + subMessage + multiMessage + divideMessage;

main.innerHTML = <h1>Calculations for the numbers ${first} and ${second}:</h1> <h2><ul>${message}</ul></h2>; }

calculate(userFirstNum, userSecondNum);