Click here to Skip to main content
15,036,363 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
in javascript i can convert or pass values to var a= <<%b%>;
but i cant able to convert <%b%>=var its getting error

What I have tried:

 for(var a=1;a<=intTextBox ;a++)  
var doct_id = parseFloat(array[a-1]);

<%int b;%>
<%b%> = doct_id;
Updated 25-Jun-16 5:12am

1 solution

There is no such thing. The question makes no sense, because var is a key word, not a data type, and there is no such thing as "int". There is nothing to convert. Perhaps you need to understand JavaScript type system, which is based on a kind of "loose-type paradigm". Please see, in particular:
JavaScript data types and data structures — JavaScript,
typeof — JavaScript.

Anyway, assuming the variables you use in your code are initialized as expected, it gives you correct code; for example, it could be
var array = [1.1, 2.2, 3.3];
var intTextBox = array.length;
// intTextBox is redundant,
// you could use array.length in the loop:

for (var a = 1; a <= intTextBox; a++) {
   var doct_id = parseFloat(array[a - 1]);

In other words, I did not see any problems in your code fragment; you just did not explain its context.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900