View Full Version : does anyone have a way to remember where to put ) and (
if any1 has a way to remember where to put the ) and ( marks, please post
ill be very :D
beetle
10-22-2002, 07:13 PM
Huh?
What?
Come again?
More detail please...:confused:
Roy Sinclair
10-22-2002, 07:22 PM
( comes before ) and both always come in pairs, each ( must have a matching ).
That's the general rule.
in a javascript code i can't remember where ) and ( comes. does it come before functions, events, oblect etc.
please tell me.
A1ien51
10-22-2002, 07:55 PM
okay now...........
naming functions???
function whatever(){hmmm="what";}
predefined functions????
alert("what");
window.open("hmm.htm");
ABC=Math.round(Math.random()*100);
??????
Your question is broad...................
If you need ( and ) then you should know.
It is not like you just put it down for the good of it
like ( hnmmmmm)
?????????????????
Can you tell us what exactly what you are looking for??
Your question is like this in our eyes: What does red mean?
And in your eyes it is like: When the traffic light is red what does that mean?
See where we are coming from??
A1ien51
beetle
10-22-2002, 08:05 PM
Uhh, let's see....the possible uses for parentheses in scripting
Delimiting function/method parametersfunction whatever(int) {
// do soemthing
}
onClick="whatever(3);"
var qs = top.location.search.substring(1);Delimiting/grouping conditionals
if (condition) {
// something
}
else {
// something else
}
var bool = (condition);Defining atoms in regular expressions
var myReg = /([A-J][1-5]){2}/;Defining backreferences in regular expressions
txt = txt.replace(/(\w)(\w)/g, "$2$1");The first two cover most of it...I'm sure I'm missing something, but hey, this is off the top of my head...
I mean about all the functions
I just can't remember where to put it
there are some scripts i can't remember just cause the have ) and (inside them.
like some long but simple scripts that that I could have rememberd if they didn't had ) and (
it's hard to explain.
well' thanks anyway every1.
mordred
10-22-2002, 08:38 PM
Structuring evaluation order
A more uncommon, but sometimes very helpful use of parentheses is to force the order of evaluation within an expression. Consider this example:
alert( 23 + "blurb blurb".substring(0, 7) ); // alerts "23blurb b"
alert( (23 + "blurb blurb").substring(0, 7) ); // alerts "23blurb"
I know, it's a little bit far-fetched. But perhaps that's the soruce of confusion of the OP, who knows?
Oh Boy .................................
:(
A1ien51
10-23-2002, 01:19 AM
hmmm,,,,,,were you thinking of this:
window.onload=hm;
where hm is the function>>> hm()??
whammy
10-23-2002, 01:30 AM
It isn't about "remembering" scripts... it's all about understanding how the program or function that you're creating flows, and the syntax of the language involved; if you understand that, than a couple of parentheses don't stand a chance against your might.
I would suggest taking some javascript tutorials... there are some good ones available here, at:
http://www.javascriptkit.com
and I would also check out:
http://www.webmonkey.com/authoring
and don't forget to "google it"... i.e. type in "javascript tutorials" in the search box here (http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=javascript+tutorials).
:)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.