semicolons are an optional line end indicator in javascript. Newlines and
closing braces can also terminate a statement.

Newlines are a slightly ambiguous line end indicator in javascript. In some
cases javascript will allow a statement to be spread across multiple lines.
Semicolons are useful to prevent those cases when they are not desired.

Thanks,

-- 
Raul


On Wed, Mar 5, 2014 at 6:14 PM, Brian Schott <[email protected]> wrote:

> In my turtle graphics app based on Eric's jdemogl1.ijs I want to use the
> drawPrimitive() function to draw a line. For now I am experimenting with
> drawing directly from ev_command_enter_ajax(ts).
>
> My version of ev_command_enter_ajax() is below, and when I leave all 3
> lines of code in, I get the error alert `ev_command_enter_ajax(d) failed`
> [Btw, notice the 'd' in the parens]. I believe the values of color (ts[0])
> and move (ts[1]) are correct strings created by the J code, because
> alert(color); and alert(move); produced the expected result.
>
> Any ideas about how to get the drawPrimitive() to work?
>
> function ev_command_enter_ajax(ts)
> {
>  var color=ts[0];
>  var move=ts[1];
>  drawPrimitive(gl.LINES,color,move);
> }
>
> Btw, the next 3 lines are copied from Eric's jdemogl1.ijs. Does the last
> one contain a typo regarding the final semicolon in the last one? (If so,
> should it be before the right curly bracket?)
>
> function ev_body_load(){init();} // must use JHS framework load handler
> function ev_bgcolor_click(){jdoajax([],"");}
> function ev_bgcolor_click_ajax(ts){bgcolor=eval(ts[0]);draw()};
>
> Thank you,
>
> --
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to