Welcome visitor
* Login
* Register
It is currently January 22nd, 2019, 8:46 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » JavaScript



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  Use a variable as a number and not as a string
PostPosted: January 12th, 2010, 6:46 pm 

Posts: 27
In JavaScript, I need to send a numeric value to the function to make some operations. What can I do for JS takes it as a number and not as a string?
addthisnumber('5');
<script type="text/javascript">
function addthisnumber(x)
{
alert(x+3); //should be 8 and it is 53!
}
</script>


Top
 Profile  
 
  Re: Use a variable as a number and not as a string
PostPosted: January 12th, 2010, 10:01 pm 

Posts: 117
Don't use the quotes when sending the number to the function ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » JavaScript


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron