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

Angela Fonteboa
Angela Fonteboa
2,267 Points

Help- Javascript

<script>

//create and initialize a new object
var calc = new Object();
calc.enteredValue = "";   

function addItUp(theVal){

    //get the value from the user input and add it to the "calc" object as "enteredValue"

    calc.enteredValue = theVal;

    //test the entry- erase this line after confirming that the event handler works and prints whatever the user enters on the calculator into the screen.

    document.getElementById("display").value = "You entered: " + calc.enteredValue;

    //set the calc object's value
            // if it's an operator, what do you do?
            // if it's a number, what do you do? 
            // if it's an equals, what do you do?
            // if it's a clear, what do you do?
    //change the display to the current outcome

}


</script>

Can someone break down what the comments are asking from me. This is for an assignment. I feel so lost. I had put in code in the top part. I added objects which were all the numbers, and signs on a calculator but then when i called it I got all the data stored rather than just storing only the button i clicked on, on the calculator.

1 Answer

Could you tell me which challenge you're on. Also, please copy and paste the code challenge question.