Closed ghost closed 2 years ago
using
Math.abs(x) > 29999999 || Math.abs(y) > 4096 || Math.abs(z) > 29999999
would likely look nicerRemember that we also must have check for negative x/y/z so your code will look like this
Math.abs(x) > 29999999 || Math.abs(y) > 4096 || Math.abs(z) > 29999999 || Math.abs(x) < -29999999 || Math.abs(y) < -4096 || Math.abs(z) < -29999999
so I think my code is nicer
No. Not really. Math.abs returns the absolute value of its first parameter. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs
Remember that we also must have check for negative x/y/z so your code will look like this
Math.abs(x) > 29999999 || Math.abs(y) > 4096 || Math.abs(z) > 29999999 || Math.abs(x) < -29999999 || Math.abs(y) < -4096 || Math.abs(z) < -29999999
so I think my code is nicer