Substring giving me errors

Hi been two days trying to figure this out.
I have a decimal number eg 4.6584255
I want to get only the first number, in this case 4, i tried using substring(0,1) and got errors, tried using javascript math.floor but did not figure out how to implement it correctly.
Basically i am converting user input number to variable then / the variable with a number eg: 10 / 2.344 = x => save to x variable
Then i want x variable to be converter to a single number without the .xxx at the back
Don't know what's wrong tried multiple timesError:
[20:27:09] Thread #1 : TypeError: Result of expression '(VAR_BETIT).substring' [undefined] is not a function. during execution of action 327956169




@uraabk oh sorry mistaken the links below your reply
so i should not use user input but variable?


@uraabk said in Substring giving me errors:
Execute code
[[NUMBER]] = 4.6584255 [[RES]] = String([[NUMBER]]).slice(0,1)
wow thanks it works

Sorry bud, I didn't see this come across my feed!
You can also use Math.trunc(decs). Just change the type from String to expression when setting the variable.log(Math.trunc(13.37)); // expected output: 13 log(Math.trunc(42.84)); // expected output: 42 log(Math.trunc(0.123)); // expected output: 0 log(Math.trunc(0.123)); // expected output: 0

@allister said in Substring giving me errors:
Sorry bud, I didn't see this come across my feed!
You can also use Math.trunc(decs). Just change the type from String to expression when setting the variable.log(Math.trunc(13.37)); // expected output: 13 log(Math.trunc(42.84)); // expected output: 42 log(Math.trunc(0.123)); // expected output: 0 log(Math.trunc(0.123)); // expected output: 0
uraabk method worked too, thank you
Between mind checking my pm?