1

In this simple jaggery code

for(var i=0;i<10;i++){

print(i);

}

Output was like

0.0

1.0

....

I need to parse these outputs into integer. I tried parseInt(i) method but it also gave the same result. What could be the reason for that?

Abimaran Kugathasan
  • 31,165
  • 11
  • 75
  • 105
Dimuthu
  • 7,946
  • 6
  • 22
  • 37
  • I think what you got is correct. JavaScript has the Number type only for numerical values. Usually you shouldn't print numbers directly. Ideally a number should be formatted before printing. i.e. You should print only after you have a string representation of the number. I'm not providing an answer as I don't have much experience with Jaggery. – Isuru Perera Feb 09 '14 at 14:19

1 Answers1

0

I'm no Jaggery expert, but i have tried your code Try It tool which can be found in Jaggery Website and it gave me expected result.

The sample code i have tried is,

<html> 
  <body> 
    <h1> 
      <% 
        for(var i=0;i<10;i++){
          print(i "\n");
        } 
      %> 
    </h1> 
  </body> 
</html>

Which gave me output,

0123456789

HTH,

DarRay

Community
  • 1
  • 1
DarRay
  • 2,550
  • 6
  • 27
  • 39