Hi, I have a c# object I'm adding to the clearscript V8 engine that looks like this:
public class Helpers
I add the helpers class (which contains this function) using this: JavascriptContext.AddHostObject("Helpers", Helpers);
However, when in my javascript I attempt to run code like below I get an argument mismatch exception:
var items = [$A1, $A2, $A3, $A6, $A9, $A12, $A13, $A16, $A19];
var value = Helpers.NTimes(items, 3);
Is this at all related to this thread:
https://clearscript.codeplex.com/discussions/537917
Thank you!
public class Helpers
{
... public int NTimes(int[] values, int targetValue)
{
int answer = 0;
if (values != null)
{
foreach (int val in values)
{
if (val == targetValue)
answer++;
}
}
return answer;
}
}I add the helpers class (which contains this function) using this: JavascriptContext.AddHostObject("Helpers", Helpers);
However, when in my javascript I attempt to run code like below I get an argument mismatch exception:
var items = [$A1, $A2, $A3, $A6, $A9, $A12, $A13, $A16, $A19];
var value = Helpers.NTimes(items, 3);
Is this at all related to this thread:
https://clearscript.codeplex.com/discussions/537917
Thank you!