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

Sharing My Solution Code

alert(Let's do some math!); let collectNum = prompt('Insert a number');

collectNum = parseFloat(collectNum)

console.log(collectNum);

let collectNum2 = prompt('Insert another number');

collectNum2 = parseFloat(collectNum2)

let message = <h1>Math with the numbers ${collectNum} and ${collectNum2}</h2>

let sum = collectNum + collectNum2; let product = collectNum * collectNum2; let quotient = collectNum / collectNum2; let difference = collectNum - collectNum2;

message += `<br> ${collectNum} + ${collectNum2} = ${sum} <br>

${collectNum} * ${collectNum2} = ${product} <br> ${collectNum} / ${collectNum2} = ${quotient} <br> ${collectNum} - ${collectNum2} = ${difference}`

console.log(message);

document.write(message);

1 Answer

To share your code in a more friendly way you can copy and paste your code into a workspace. Then, hit the camera icon at the top right of your workspace. It'll generate a link that allows your code and its syntax to be evaluated (color coding, etc.)