Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSNI eval function returning float

 
David Kowalski
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys, I have a problem, I'm in need of using eval function from inside gtw, that calculates my function gives as String, for example Math.cos(5+9); and returning float.
I have been trying around with


However I can't make it work even for int numbers, not even for 5+2. Any idea how to fix that?
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Kowalski wrote:
However I can't make it work even for int numbers, ...

ItDoesntWorkIsUseless
What is the expected behavior and what is the observed behavior. Please TellTheDetails

Looking at the code you posted (mind you I do not work with JS), if I think logically, then I would say there is no "myVar" defined which you are trying to return.
 
Paul Clapham
Sheriff
Posts: 20711
29
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you're trying to evaluate this, if I understand it correctly:



I would expect that to assign a string with three characters to the "myVar" variable. I wouldn't expect that coercing that string to int would produce 7, either. But the fix should be pretty clear, shouldn't it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic