TypeError: Cannot find function 1.0
I have a script and I'm almost done but I get this error and frankly I have no idea what is wrong here. I'm rather new to Javascript so I suspect I did something wrong in the syntax somewhere. Here is an extract from the script containing the offending line :
var gc = 0;
var seg;
var segCount = 0;
var groupCount = 0;
var groupLevel = 0;
var segments = new Array();
var sk = "";
for(gc = 0; gc <= groupLevel; gc++)
{
if(gc >= groupDelimiters.length) break;
if(seg.name() == groupDelimiters[gc])
{
//ok we start another group
开发者_开发知识库 grKeys.startNewGroup(groupLevel, groupCriterionExtractors[groupLevel](segCount), groupCount);
groupLevel = gc + 1; //This line is flagged with the error in the title
groupCount++;
}
}
ideas, pointers, any help would be appreciated.
edit - I got screwed by the $%*& markup syntax from outer space. Here is the code as it should have appeared.
It's hard to tell without more info but I would guess from the error message that the following code:
groupCriterionExtractors[groupLevel]
is yielding the value 1.0 which you are then trying to call with:
(segCount)
So it's like saying:
grKeys.startNewGroup(groupLevel, 1.0(segCount), groupCount);
There are several problems with the above code such as the for loop, post what you're trying to do and some test data and I can help more
there’s a { missing in your code and the for() syntax is wrong.
for ([initialExpression]; [condition]; [incrementExpression])
ah, yes, your for() loop won’t execute anything as it is now.
This:
for(gc = 0; gc = groupDelimiters.length) break;
if (seg.name() == groupDelimiters[gc])
...
Should probably be
for (gc = 0; gc < groupDelimiters.length; gc++) {
if (seg.name() == groupDelimiters[gc])
...
精彩评论