-
• #2
Is this the correct syntax to use it in class Graphics?
Almos :) The first argument of
apply
andcall
is thethis
argument. It doesn't matter forMath.max
becausemax
doesn't care about knowing it's called viaMath
, butdrawString
needs to know which Graphics instance it's called on.If you do
g.drawString.apply(g,p);
you should be fine -
• #3
Thanks :)
So g.drawString() also can be called this way
g["drawString"]("Hello",10,10);
andg["drawString"].apply(g,p);
works too.
Working on a Pixl,js with firmware 2v04 .
Sometimes parameter for function are stored in arrays and apply is used to convert array to parameter.
Try to use this for g.drawString()
Screen does not show "Hello".
Is this the correct syntax to use it in class Graphics?