= n / 1 - 0.5 = n - 0.5
which solves to `n = 0` or `n = 1`. It seems that Nashorn picks the
`n = 0` case instead of the `n = 1` case.
---
Esben Andreasen
Nashorn can produce a ClassCastException when executing a plain
JavaScript program.
The exception happens in a situation where the arguments variable is
used in conjunction with call and apply.
## Observed behavior
Code:
```
function F(SOME_PARAMETER) {
Function.prototype.call.apply(G, argumen
Hi
I am not sure if this is a bug or feature of the Nashorn engine. But
it looks like some String-prototype methods are missing, yet the
methods are somehow present when used in the right way.
Minimal example: calling `startsWith` by using `call`:
```
1 $ jjs -v
2 jjs> String.prototype.startsW
Hi
I am not sure if this is a bug or feature of the Nashorn engine. But
it looks like some String-prototype methods are missing, yet the
methods are somehow present when used in the right way.
Minimal example: calling `startsWith` by using `call`:
```
1 $ jjs -v
2 jjs> String.prototype.startsW
abc", "a")
>
> Finally, .startsWith is only present on primitive String values (as
> they’re java.lang.String), not on JS String objects, that’s why you were
> getting results you didn’t expect from “typeof Object(string).startsWith”
>
> HTH,
> Attila.
>
>
> &g
Hi
I am not sure if this is a bug or a problem with my setup.
I observe a surprising difference between the "external" (jjs) and the
"internal" (new ScriptEngineManager().getEngineByName("JavaScript"))
Nashorn when evaluating a regular expression method. The two Nashorns seems
to be the same, but
when it is
> returned by a script.
>
> Hannes
>
>
> > Am 21.12.2016 <21%2012%2020%2016> um 11:09 schrieb Esben Andreasen <
> es...@esbena.dk>:
> >
> > Hi
> >
> > I am not sure if this is a bug or a problem with my setup.
> > I o
Hi
I stumbled upon a minor discrepancy between Nashorn and other
JavaScript engines when doing regexp matching with the multiline flag
enabled.
Nashorn
```
$ jjs -version
nashorn 1.8.0_111
jjs> String.prototype.replace.apply("a\nb\rc\n\rd\r\ne", [/^(.*)/gm,"*$1"]);
*a
*c
**
*e
```
Notice that th