0

I'm new to Javascript and am confused about the error messages I get:

I have the JavaScript Code:

function tile(x,y) {
return ((worldw * y) + x);
}

alert(tile(5,5));

But I get the error message in Chrome that "Object is not a function".

How can I fix this and what does the error message mean?

2
  • worldw is a static variable defined as varworldw = 50; Commented Jun 18, 2011 at 2:47
  • 1
    varworldw = 50; is hopefully a typo. That should be var worldw = 50; Commented Jun 18, 2011 at 3:01

1 Answer 1

2

The code works fine in Chrome and jsfiddle, if I replace worldw with a numeric value. So I do not see an issue based on what you posted.

What is worldw, and can you post more code that reproduces the problem?

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, I realised the problem was just I had stupidly got an array called tile as well and so it was calling that, not the function :/ Thanks anyway :)
Ah, that makes sense... in any case, sometimes you just need another pair of eyes. Glad you got it working!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.