Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19053

Re: Scoping issue I think

Message-ID <1812795.mZEXYNaEgZ@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-03-29 23:43 +0100
Subject Re: Scoping issue I think
Newsgroups comp.lang.javascript
References <f52678fa-29a5-4b1c-b125-9d3e5ec2eddb@googlegroups.com>

Show all headers | View raw


patrickmartin145@gmail.com wrote:
^^^^^^^^^^^^^^^^^^^^^^^^^^
Who?

> I am really stuck here.  The following code fails to set the children
> correctly.  However I can see the correct values in _children with
> children being null.
> 
> I am pretty sure this is a scoping/privacy issue

It has nothing to do with that.

> but I can't see anything wrong with my code.

Your code is syntactically valid, but it does not make sense (semantics 
error).

> dex.csv.toHierarchicalJson = function(csv, rootName, rootCategory)
> {
>   var connections = dex.csv.connections(csv);
>   var json =
>   {
>     "name" : rootName,
>     "category" : rootCategory,
>     "children" : dex.csv.getChildren(connections, 0)
>   }
> 
>   getChildren(connections, depth)
    ^^^^^^^^^^^
“ReferenceError: getChildren is not defined”

>   {
    ^
In this context this is the delimiter of a Block statement, essentially a 
no-op.  ECMAScript implementations do not support implicit block scoping; 
the scope of an identifier is defined by the execution context in which it 
was defined.  There are three types of execution contexts: global, function, 
and eval (whereas the “with” statement is a special case).

> […]
>   }
> 
>   return json;
> };
> 
> Any help would be greatly appreciated!!!

Use the script console and RTFFAQ, RTFM next time, and get a working 
keyboard.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Scoping issue I think patrickmartin145@gmail.com - 2013-03-29 15:06 -0700
  Re: Scoping issue I think patrickmartin145@gmail.com - 2013-03-29 15:11 -0700
  Re: Scoping issue I think patrickmartin145@gmail.com - 2013-03-29 15:29 -0700
  Re: Scoping issue I think Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-29 23:43 +0100
  Re: Scoping issue I think patrickmartin145@gmail.com - 2013-03-31 09:13 -0700
    Re: Scoping issue I think Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-31 18:26 +0200

csiph-web