@pedau strings and numbers are objects. The objects have a series of built in methods (ways of manipulating the object). For instance a string of:
var name = “pedau”;
has a method toUpperCase() which converts the string to uppercase like this:
name.toUpperCase();
which results in:
name = "PEDAU";
When you try to call method on an object that doesn’t exist as in this example
function doStuff(name)
{
console.log( names.toUpperCase() );
}
You will get the error you’ve been getting because names doesn’t exist (we defined name in the function) and since names doesn’t exist the method toUpperCase() will not exist.
In your case you may be dealing with a typo (names vs name), you may be trying to pass a variable that has never been defined OR you may have something like this:
var name;
and since name has been declared but not defined it will also have no methods attached to it.
If I were debugging this, I’d first do a quick scan of the variables/names being passed in and make sure all those are being set. Next I’d console.log() the variables and see which one is not being set. This should pop up fairly quickly.
Thank you for your replies.
When i get back into it, i’ll do a scan of the variables passed in. I think it will most likely be a typo error at this stage.
Thanks.