Chamara Denipitiya
Chamara Denipitiya

Reputation: 93

What's the meaning behind open and closed parentheses?

What is the point or meaning behind having code that has open and closes parentheses?

Here's the sample code that I'm looking at:

<input style="background-color:#bfdfff" name="fn" type="text" id="kfn" 
    size="55" maxlength="55" onfocus=                   
        "this.select(); 
        if (this.value==''){
          this.style.background='#00CCCC';
        }
        else
        {
          this.style.background='#99CCFF';
        }
" />

The line I'm curious about is here:

this.select(); 

What's the meaning of using open and close brackets ()?

Upvotes: 0

Views: 4198

Answers (2)

Craig White
Craig White

Reputation: 14002

Adding to what ernest said, it also helps to identify a function rather than just a variable. Without the parentheses you would have no idea if something was a function or a variable if you were unfamiliar with the code.

Upvotes: 2

Ernest Friedman-Hill
Ernest Friedman-Hill

Reputation: 81684

THose are called parentheses, not "brackets". They enclose the arguments to a function call. The function select doesn't take any arguments, but you still have to put the parentheses there to call the function.

Upvotes: 3

Related Questions