Math.trunc() COMMAND


#1

Hi

I’m wondering why Math.trunc(x) does not work in AppLab?

For example:
var x = 2.2;
//x = Math.round(x);
x = Math.trunc(x);
console.log(x);

Math.round works but Math.trunc does not work

Thanks


#2

I dont think it is supported on AppLab. I don’t see it in the documentation. https://docs.code.org/applab/


#3

Where can I request that AppLab add Math.trunc into the pool of commands?

Thoughts?


#4

Try support@code.org!


#5

Thank you so much. Peace


#6

Math.floor(num) works for me! Not in the docs, but a vanilla javascript function.