Quantcast
Channel: Will this object always re-call the function? - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by sabotero for Will this object always re-call the function?

They are equivalent. In both the getElementByIdmethod is called only one time (when you create the object) and then the stored value in the variable is returned at all times when you do Objek.node

View Article



Answer by Radek Pech for Will this object always re-call the function?

In both cases getElementById() is called only once (when you create the object, not when you use objek.node). In first case ONLY getElementById() is called and value assigned into new object......

View Article

Will this object always re-call the function?

Here is the first way: var Objek = { node : document.getElementById(known_id), } So, when i call Objek.node does this always call the document.getElementById ? Is this second way better? : var Objek =...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images