JavaScript Calculator: Parentheses

I’m trying to program parentheses into my JavaScript calculator, but I’m having trouble doing it. What I’ve got is this:

this.display = “(”;

where the variable, display, is what will be displayed in the calculator.

Do you have any suggestions for me, or any source code I could look at? Thanks!

You are going to have to provide a bit more information.

You have this.display but you talk about a variable display.

A variable is declared by a var statement. for example

var display;

this.display is the display property of the this object. But what is “this”?

How all this fits in with you calculator can only be speculated.

‘this’ is only the generic form of the variable, display. In earlier code in my calculator, I declared display as a variable: var display = 0;

Display is initially set as 0 so the calculator starts with a blank screen.

There are actually two variables in this calculator which I have declared: display and total. Both are declared in my code before the actual code I posted.
var display = 0;
var total = 0;
When the user enters a number, this.display (the generic form) is assigned the value of that number. When an operand is hit (+, -, / …), total is assigned the current value of display, and then display is reset to 0.

Thank you very much for your help!

I apologize; I never answered what ‘this’ is. ‘this’ is the calculator object (if I understand your question properly. I’m very sorry; I’m a new programmer). The function I initially posted and every other function in the calculator is really a prototype function for the calculator object. So when I use this.display, I’m able to access the variable in any of my prototype functions.

Please let me know if this didn’t answer the question you asked. I feel like I hit the ball way into left field.