What does this mean when an object has no method in javascript?

I get the following error:

Uncaught TypeError: Object #<an Object> has no method 'indexOf'

for this line:

  else if(file.indexOf(".mp3") == file.length - 4 && return_path === false)

What does it mean? Is this an object? What is a method? And what would be a simple apllied method example? I am really new to javascript, so please try this.

+1
source share
1 answer
  • What does it mean? It just means that any type filedoes not have a method at the moment .indexOf(), in this case it does not mean the string that you think it / should be.
  • Which object? file
  • What is a method? 0, like any other language, objects have methods .indexOf()- this is what it is trying to run here.

apllied? javascript, , , .

, " ", , file.split("."), ..... String .

+4

All Articles