I'm using Jade template engine with NOde.js. I have two variables:
a = 0.0378
b = 0.1545
in Jade I do:
- var result = a + b*2
and I get a very strange number when I do #{result}
0.03780.309
It seems to concatenate the numbers as strings. Could someone tell me how can I use arithmetic operators in Jade?
Thanks
Are you sure that a
(and also b
) is a number and not a string?
If it is a string you will need to to convert it to a number via parseFloat
:
- var result = parseFloat(a)+parseFloat(b)*2