Javascript Question

I have a geogebra applet in a panel pane, and a string
cmd = r' ggbApp.evalCommand('r_1=2.8'); ggbApp.evalCommand('theta_1=45.0 deg'); ggbApp.evalCommand('r_2=3.2'); ggbApp.evalCommand('theta_2=-71.6 deg');

When I execute Javascript(cmd) nothing happens.
When I paste that same string into the console,
the functions are executed and take effect.

Anybody have an explanation?

The example is section 1.2 in

Really weird:

  • if the Javascript function is invoked as part of a function, it fails.
  • if it is executed directly in a notebook cell, it succeeds?!

If I wrap the statement in display(Javascript(cmd)) it executes.

If anybody knows what is going on and/or what I should be doing instead,
I’d love to hear back!