I have some small issue in j query. my code is like this
var tt = 8*1;
var n = tt.toString();
var uu1 = n.split('*');
var count = uu1.length;
var table_id44 = '';
for(k = 0,m = 1; k < count-1; k++,m++)
{
var table_id44[m] = uu1[k];
}
when I put that i got error in console log SyntaxError: missing ; before statement.please someone help.
table_id44
should be declared as an array. and you don't need to redeclare the variable in the for
loop.
var tt = 8 * 1;
var n = tt.toString();
var uu1 = n.split('*');
var count = uu1.length;
var table_id44 = [];
for (k = 0, m = 1; k < count - 1; k++, m++) {
table_id44[m] = uu1[k];
}
Try this, You are declaring it as string var table_id44 = '';
and using it as an array
.
var tt = "8 * 1";//use it as string so that you can further split it on *
var n = tt.toString();
var uu1 = n.split('*');
var table_id44 = [];
for (k = 0, m = 1; k < count - 1; k++, m++)
{
table_id44[m] = uu1[k];//prevent multiple declaration in loop
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.