1

I have this object:

var Point = {
    step: function () {
        alert("hello");
    }
};

This works:Point.step();.

How to make it work with the [ ] notation? Meaning Point["property_name"].

2
  • 6
    Point["step"]()? Commented Apr 1, 2015 at 8:25
  • @ArunPJohny Can you please write your comment as an answer so you can take the credits for answering the question? :) Commented Apr 1, 2015 at 8:31

1 Answer 1

1

It is Point["step"]();. Here is the snippet:

var Point = {
    step: function () {
        alert("hello");
    }
};

Point["step"]();

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

1 Comment

That's way too easy; moreover, already pointed by Arun P Johny.

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.