KubeJS

KubeJS

61M Downloads

Nullish Coalescing Operator (foo??bar) does not work

Qualia765 opened this issue ยท 3 comments

commented

Minecraft Version

1.18.2

KubeJS Version

kubejs-forge-1802.5.5-build.569.jar

Rhino Version

rhino-forge-1802.2.1-build.255.jar

Architectury Version

architectury-4.11.89-forge.jar

Forge/Fabric Version

Forge - 40.1.86

Describe your issue

 // ~~~~ works correctly ~~~~
0 ?? 5 // returns 0
3 ?? 1 // returns 3
"" ?? 69  // returns ""
undefined ?? "yes" // returns "yes"
true ?? "oh yeah" // returns true
undefined ?? undefined // return undefined
null ?? null // returns null

 // ~~~~ does not work correctly ~~~~
undefined ?? 4 // returns 0 should be 4
false ?? "word" //returns 0 should be false
null ?? 69 //returns 0 should be 69

Crash report/logs

No response

commented

just rechecked all of them, that was the only error in my report

commented

wait my bad your right

commented

Im pretty sure 3 ?? 1 should return 3