JavaScript Wiki
Advertisement

Not operators, examples[]

Be careful: quotes are not operators, they're part of the language's syntax. Operators must take at least one operand. This also applies to all the 'operators' in the Basic Operators page; I shall attempt to move this into a Basic Syntax page and a Values page, perhaps. Additionally, can we have some sort of consistency in the examples? I propose using <source> exclusively, and removing the variable assignment from the examples — it needlessly complicates them. You can provide the return value in a comment alongside the expression. — Twey 01:58, 18 October 2008 (UTC)

Would they be puncuation, then? And are operators also punctation? I'm trying to reformulate the category tree.
I agree with always using <source>; some plain examples (indented one space) are scattered around because the syntax highlighting extension wasn't enabled at first.
Regarding "variable assignment," what about Number#.25? --Jesdisciple (talk) 02:13, 18 October 2008 (UTC)
I see no more reason for the assignment there than on any other example. — Twey 07:30, 18 October 2008 (UTC)
The modulo is an obscure mathematical operation. I think some people will wonder why (5.5 % 2 === 1.5). The assignment provides a name by which to refer to the value and explain the logic: --Jesdisciple (talk) 04:05, 19 October 2008 (UTC)
I think it would be better to assign the variable in the explanation ('if x is 5.5 % 2, ...') rather than clutter up the code with other concepts. — Twey 04:58, 19 October 2008 (UTC)

Comparison (and other) operators[]

Since there are several operators that behave differently depending on the types of their arguments, it makes sense to consider them separate operators for the purposes of explanation. In the original boolean operators section, I found myself writing 'if the arguments are strings, then...' 'if the arguments are numbers, then...'. It is neater to put the relevant explanations and examples on the pages of the relevant types. — Twey 04:58, 19 October 2008 (UTC)

From an editing (as opposed to reading) perspective, it's rather clumsy because updates to one article can't automatically propagate. What if only the differences were noted on the specialized pages and {{main}} were used to direct the reader to Boolean? --Jesdisciple (talk) 06:26, 19 October 2008 (UTC)
But we still end up with a rather long, mixed, and uncategorised list of various examples for different types on Boolean. I agree that it's irritating that the changes won't propagate, but to be honest I don't think there will ever need to be any changes across all of them. They're almost completely separate, except for the very basic bits that will probably never need to be changed anyway.
Twey 06:35, 19 October 2008 (UTC)
Advertisement