What Does It Mean When An Object Has No Method In Javascript?
I get the following error: Uncaught TypeError: Object # has no method 'indexOf' for this line: else if(file.indexOf('.mp3') == file.length - 4 && return
Solution 1:
- What does this mean?
It simply means that whatever type
file
is at the moment, it doesn't have a.indexOf()
method, in this case that means it's not the string you think it is/should be. - Wich is the object?
file
- What is a method? 0 like any other language, objects have methods,
.indexOf()
is what it's trying to run here.
And what would be am simple example of an apllied method? I'm really new to javascript so please keep it simple.
I'm not sure what you mean by "applied method", but everything here just resolved around calling a method on an object, for example file.split(".")
to turn it into an array, etc...any method String has.
Post a Comment for "What Does It Mean When An Object Has No Method In Javascript?"