0

I have a weird behavior on my arms :

I declare an object, properties shall execute in sequence, which they do, but in one there is a simple pass through nothing written in it happens.

Do I have a scope problem ?

Here is a code fragment where verteX is my object

stepsCalcul: function() {
  var test = 2;
  verteX.testCheck = test*2; //returns undefined
  alert('stuff') //alerts nothing
  console.log("logged stuff")//logs nothing
  verteX.mouseCoordinates();
  return true;
},

I sort a jsFiddle aswell

http://jsfiddle.net/AEWrK/3/

Thanks!

1
  • 2
    The problem in your fiddle is that you don't call the init method. Here's an updated fiddle. Commented Nov 22, 2012 at 15:03

1 Answer 1

2

Based on your fiddle, you're not calling the init function.

Replace verteX.init; with verteX.init();

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

4 Comments

I think I've been totally mislead by the mousemove event being launch, does object property calling jquery methods execute stand-alone-ly ?
from your fiddle, verteX.mouseCoordinate doesn't contain a function, but a jQuery object. Incidently you bound an handler to the "mousemove" event, while affectif the jQuery object to mouseCoordinate.
Remember, verteX.init is the function, verteX.init() is the result returned by the function. Functions are just objects, much like an int, or a string, you can pass them around, or invoke them.
Thank you for the explanation, I was wrongly thinking than an object property was a function by default.

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.