Array assignment

For n=0 To g.length - 1
  If g(n)=s Then g(n)=g(n) & "*"      <== this got error "bad assignment"

Any idea?

Do you Dim g as an array anywhere? If you don’t, the BASIC to JavaScript translator has no idea that it should use array notation.

BASIC uses () for both arrays and function calls.
JavaScript uses () for function call, [] for arrays.

This will also work:

If g[n]=s Then g[n]=g[n] & "*"