Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > variables should be declared in examples in the FAQ

Reply
Thread Tools

variables should be declared in examples in the FAQ

 
 
Nickolay Ponomarev
Guest
Posts: n/a
 
      01-22-2007
Assigning to undeclared variables is considered a bad practice (I hope
I don't need to explain the reasons here). The examples in the FAQ
should declare the variables it uses:

http://www.jibbering.com/faq/#FAQ4_15
> DocDom = (document.getElementById?true:false);


http://www.jibbering.com/faq/#FAQ4_42
> wRef = window.open("http://example.com/page.html","windowName");


Nickolay

 
Reply With Quote
 
 
 
 
Dr J R Stockton
Guest
Posts: n/a
 
      01-22-2007
In comp.lang.javascript message <(E-Mail Removed)
legroups.com>, Sun, 21 Jan 2007 17:37:24, Nickolay Ponomarev
<(E-Mail Removed)> posted:
>Assigning to undeclared variables is considered a bad practice (I hope
>I don't need to explain the reasons here). The examples in the FAQ
>should declare the variables it uses:
>
>http://www.jibbering.com/faq/#FAQ4_15
>> DocDom = (document.getElementById?true:false);

>
>http://www.jibbering.com/faq/#FAQ4_42
>> wRef = window.open("http://example.com/page.html","windowName");



There is no need to show the declaration of variables unless the region
within which they need to be declared is shown in full.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Delphi 3? Turnpike 6.05
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.bancoems.com/CompLangPascalDelphiMisc-MiniFAQ.htm> clpdmFAQ;
<URL:http://www.borland.com/newsgroups/guide.html> news:borland.* Guidelines
 
Reply With Quote
 
 
 
 
Nickolay Ponomarev
Guest
Posts: n/a
 
      01-23-2007
On Jan 22, 4:46 pm, Dr J R Stockton <(E-Mail Removed)>
wrote:
> In comp.lang.javascript message <(E-Mail Removed)
> legroups.com>, Sun, 21 Jan 2007 17:37:24, Nickolay Ponomarev
> <(E-Mail Removed)> posted:
>
> >Assigning to undeclared variables is considered a bad practice (I hope
> >I don't need to explain the reasons here). The examples in the FAQ
> >should declare the variables it uses:

>
> >http://www.jibbering.com/faq/#FAQ4_15
> >> DocDom = (document.getElementById?true:false);

>
> >http://www.jibbering.com/faq/#FAQ4_42
> >> wRef = window.open("http://example.com/page.html","windowName");

> There is no need to show the declaration of variables unless the region
> within which they need to be declared is shown in full.
>

It is shown in full, since you can copy paste these snippets to use in
your code (I imagine this is the reason those snippets are in the FAQ).

No need to write a several-pages-long witty response as to why they are
not in fact shown in full - I'm not going to argue anymore.

Nickolay

 
Reply With Quote
 
Lee
Guest
Posts: n/a
 
      01-23-2007
Nickolay Ponomarev said:
>
>On Jan 22, 4:46 pm, Dr J R Stockton <(E-Mail Removed)>
>wrote:
>> In comp.lang.javascript message <(E-Mail Removed)
>> legroups.com>, Sun, 21 Jan 2007 17:37:24, Nickolay Ponomarev
>> <(E-Mail Removed)> posted:
>>
>> >Assigning to undeclared variables is considered a bad practice (I hope
>> >I don't need to explain the reasons here). The examples in the FAQ
>> >should declare the variables it uses:

>>
>> >http://www.jibbering.com/faq/#FAQ4_15
>> >> DocDom = (document.getElementById?true:false);

>>
>> >http://www.jibbering.com/faq/#FAQ4_42
>> >> wRef = window.open("http://example.com/page.html","windowName");

>> There is no need to show the declaration of variables unless the region
>> within which they need to be declared is shown in full.
>>

>It is shown in full, since you can copy paste these snippets to use in
>your code (I imagine this is the reason those snippets are in the FAQ).
>
>No need to write a several-pages-long witty response as to why they are
>not in fact shown in full - I'm not going to argue anymore.


What a jerk. "Don't bother pointing out that I'm wrong, I'm not
going to respond".

if(window.open){
wRef = window.open("http://example.com/page.html","windowName");
}

Hardly qualifies as a snippet that would be copied and pasted.


--

 
Reply With Quote
 
Nickolay Ponomarev
Guest
Posts: n/a
 
      01-23-2007
On Jan 23, 4:35 am, Lee <(E-Mail Removed)> wrote:
> Nickolay Ponomarev said:
>
> >No need to write a several-pages-long witty response as to why they are
> >not in fact shown in full - I'm not going to argue anymore.

> What a jerk. "Don't bother pointing out that I'm wrong, I'm not
> going to respond".
>
> if(window.open){
> wRef = window.open("http://example.com/page.html","windowName");
>
> }Hardly qualifies as a snippet that would be copied and pasted.
>

At least you kept it short

Nickolay

 
Reply With Quote
 
Nickolay Ponomarev
Guest
Posts: n/a
 
      01-23-2007
Nickolay Ponomarev wrote:
> On Jan 23, 4:35 am, Lee <(E-Mail Removed)> wrote:
> > if(window.open){
> > wRef = window.open("http://example.com/page.html","windowName");
> >
> > }
> > Hardly qualifies as a snippet that would be copied and pasted.
> >


BTW, that snippet is rather questionable. I wonder on what browsers
that support scripting the window.open call doesn't happen.

Nickolay

 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      01-23-2007
Nickolay Ponomarev wrote:
> Nickolay Ponomarev wrote:
>> On Jan 23, 4:35 am, Lee wrote:
>>> if(window.open){
>>> wRef = window.open("http://example.com/page.html","windowName");
>>>
>>> }
>>> Hardly qualifies as a snippet that would be copied and pasted.


Indeed the intention of the entry (and linked resources) is to
discourage the attempt to open new windows.

> BTW, that snippet is rather questionable. I wonder on what browsers
> that support scripting the window.open call doesn't happen.


Embedded browsers on small systems that have no "window" concept in
their UI often do not provide a window.open method. There would be
little point as they could not open new "windows" even if they wanted
to. A specific example is WebBrowser 2.0 on the Palm OS (which is a
ECMA 262, 3rd Ed. scriptable, W3C DOM (Core + HTML) Level 1 standard
browser).

Given that mobile phones are now at the point where it is becoming
difficult to get one that does not have a web browser these small-scale
and functionally restricted browsers are probably about to peek in
their relevance.

Richard.

 
Reply With Quote
 
Nickolay Ponomarev
Guest
Posts: n/a
 
      01-23-2007
On Jan 23, 1:52 pm, "Richard Cornford" <(E-Mail Removed)>
wrote:
> Nickolay Ponomarev wrote:
> > Nickolay Ponomarev wrote:
> >> On Jan 23, 4:35 am, Lee wrote:
> >>> if(window.open){
> >>> wRef = window.open("http://example.com/page.html","windowName");

>
> >>> }
> >>>

> Hardly qualifies as a snippet that would be copied and pasted.Indeed the intention of the entry (and linked resources) is to
> discourage the attempt to open new windows.
>
> > BTW, that snippet is rather questionable. I wonder on what browsers
> > that support scripting the window.open call doesn't happen.

> Embedded browsers on small systems that have no "window" concept in
> their UI often do not provide a window.open method. There would be
> little point as they could not open new "windows" even if they wanted
> to. A specific example is WebBrowser 2.0 on the Palm OS (which is a
> ECMA 262, 3rd Ed. scriptable, W3C DOM (Core + HTML) Level 1 standard
> browser).
>

Thanks for the information; didn't know there are embedded browsers
with DOM support, but without window.open.

By the way, I was looking at the first snippet (4.15) when I claimed it
was on the page for easy copy-paste.

Nickolay

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where Should Variables be Declared? Garrett Smith Javascript 2 09-16-2009 04:45 PM
COVER LETTERS RESUME EXAMPLES AND CV EXAMPLES AVAILABLE CURRICULUM VITAE rawebadvert3 Computer Support 0 08-21-2007 03:07 AM
COVER LETTERS RESUME EXAMPLES AND CV EXAMPLES AVAILABLE rawebadvert3 Computer Support 0 05-25-2007 04:18 AM
declared or not declared ? JohnZing ASP .Net 3 02-05-2006 08:38 PM
In which scope should variables be declared? elzacho C Programming 5 09-24-2005 03:50 PM



Advertisments