Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #30385 > unrolled thread
| Started by | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| First post | 2016-05-03 00:05 +0200 |
| Last post | 2016-05-03 00:05 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.javascript
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Adding data to a function "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-05-03 00:05 +0200
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2016-05-03 00:05 +0200 |
| Subject | Re: Adding data to a function |
| Message-ID | <XnsA5FDFB322EBeejj99@194.109.6.166> |
ram@zedat.fu-berlin.de (Stefan Ram) wrote on 02 May 2016 in
comp.lang.javascript:
> The following function always would recompute
> Żwindow.document.getElementById( "info" )Ž.
>
> "use strict";
>
> function f()
> { window.document.getElementById( "info" ).innerHTML
> = 'The function "f" was called.'; }
>
> Is it good style to attach this data to f as a property of f,
> so that it does not have to be recomputed each time f is
> being called, i.e.: [....]
Methinks "Is it good style to ... ?"
is not a good question,
as it calls for subjective preferences
like "is this a beautiful painting?"
You could ask:
"Is it clearer scripting sourcecode for newbees?"
or
"Does this involve less cpu-time?"
Methinks, the clearer code Q is important, sometimes.
The cpu-time consumption is not, as:
- how many times would you want an innerHTML to change per second?
- the difference in fetching a DOM-pointer from a DOM id-array or as an
object-property [or even as a simple variable] will not matter much imho,
but you could try to measure that for different browsers, if you like.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to top | Article view | comp.lang.javascript
csiph-web