Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 12-06-2012, 03:29 PM   #1
Beta Member
 
franklin's Avatar
 
Join Date: Dec 2012
Posts: 5
Default What are these brackets after the function name?

function functionname()

It is an example of a function in JavaScript
__________________

franklin is offline   Reply With Quote
Old 12-06-2012, 05:51 PM   #2
Fully Optimized
 
OhSnapWord's Avatar
 
Join Date: Jan 2012
Location: USA
Posts: 1,853
Default Re: What are these brackets after the function name?

If I'm not mistaken, those brackets contain arguments for the function.

Function MyFunction(var1, var2, etc...)
__________________

__________________
FX-8350 @ 4.7 cooled by H80, 32GB Mushkin Enhanced Blackline 2133, Asus Sabertooth 990FX, 2x Radeon HD 7850 2GB in X-fire, 500GB Samsung 850 Evo, 4TB Seagate, 3TB WD Black, 2x 1TB WD RED in RAID 0
OhSnapWord is offline   Reply With Quote
Old 12-07-2012, 06:59 AM   #3
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: What are these brackets after the function name?

Quote:
Originally Posted by OhSnapWord View Post
If I'm not mistaken, those brackets contain arguments for the function.

Function MyFunction(var1, var2, etc...)
Yup, this - it's the same in a lot of languages.

When the function doesn't have any parameters the brackets are still needed as a way of differentiating between functions and fields.
__________________
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 12-07-2012, 07:56 AM   #4
Fully Optimized
 
strollin's Avatar
 
Join Date: Mar 2011
Location: USA
Posts: 1,943
Default Re: What are these brackets after the function name?

Technically, they're braces () not brackets []. Brackets are used in many languages in array definitions.
strollin is offline   Reply With Quote
Old 12-07-2012, 08:11 AM   #5
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: What are these brackets after the function name?

Quote:
Originally Posted by strollin View Post
Technically, they're braces () not brackets []. Brackets are used in many languages in array definitions.
Nope, in the good proper English of the UK they're technically known as brackets

But yes, this does get confusing...
__________________
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 12-07-2012, 10:57 AM   #6
Fully Optimized
 
strollin's Avatar
 
Join Date: Mar 2011
Location: USA
Posts: 1,943
Default Re: What are these brackets after the function name?

Interesting... What are these [] called in the UK?
strollin is offline   Reply With Quote
Old 12-07-2012, 10:59 AM   #7
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: What are these brackets after the function name?

Quote:
Originally Posted by strollin View Post
Interesting... What are these [] called in the UK?
Simply square brackets most of the time.
__________________
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 12-07-2012, 11:15 AM   #8
Fully Optimized
 
jmacavali's Avatar
 
Join Date: Jun 2009
Posts: 4,867
Default Re: What are these brackets after the function name?

I have nothing to contribute to the OP but

() = parenthesis
[] = brackets
{} = fancy brackets

where I'm from.
__________________
****************************************
Don't take life too seriously -- no one gets out alive. Plus, who wants to arrive to the hereafter in pristine condition wearing a suit and tie?
I want to slide in sideways, worn out, used up, hair a mess, clothes tattered, & screaming, "Whooo! What a ride!"
****************************************
jmacavali is offline   Reply With Quote
Old 12-07-2012, 11:18 AM   #9
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: What are these brackets after the function name?

Quote:
Originally Posted by jmacavali View Post
I have nothing to contribute to the OP but

() = parenthesis
[] = brackets
{} = fancy brackets

where I'm from.
() = brackets
[] = square brackets
{} = curly brackets

UK style!
__________________
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 12-07-2012, 11:40 AM   #10
Fully Optimized
 
vampist's Avatar
 
Join Date: Oct 2008
Location: USA
Posts: 2,404
Default Re: What are these brackets after the function name?

Quote:
Originally Posted by berry120 View Post
() = brackets
[] = square brackets
{} = curly brackets

UK style!
() = Parentheses
[] = Brackets (some times square brackets)
{} = Curly Brackets

Vampist style!
__________________

__________________
Everyone's Favorite Turd xD
ET: "Phone home!"
Geek: "ping 127.0.0.1"

"If that guy knew half the $h*t that I know, his fuzzy little head would explode. " - Matthew Farrell
vampist is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 09:20 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0