D
Dr J R Stockton
In comp.lang.javascript message <[email protected].
Ignore him. For a new JavaScripter, machine efficiency is of minor
importance; what matters is that you, and maybe others, can read your
code easily.
The chief purpose of composing strings is to have then displayed and
read. Only for strings of many lines is it possible for the "joining"
part of composing to take time significant in comparison with the time
taken to display them; and on any recent machine (clock speed over about
2 MHz), it is reading which will take by far the longest time.
However,
var msg = "this " + "that " +
"tother"
is easier to type.
Code should be indented by about two spaces per unclosed "{" to show
intended structure, if it is intended to be read by people (including
yourself, later). A considerate commercial site will strip that, and
most other comment, from the publicly-distributed version.
Why is that?
Ignore him. For a new JavaScripter, machine efficiency is of minor
importance; what matters is that you, and maybe others, can read your
code easily.
The chief purpose of composing strings is to have then displayed and
read. Only for strings of many lines is it possible for the "joining"
part of composing to take time significant in comparison with the time
taken to display them; and on any recent machine (clock speed over about
2 MHz), it is reading which will take by far the longest time.
However,
var msg = "this " + "that " +
"tother"
is easier to type.
Code should be indented by about two spaces per unclosed "{" to show
intended structure, if it is intended to be read by people (including
yourself, later). A considerate commercial site will strip that, and
most other comment, from the publicly-distributed version.