Javascript syntax for abbreviating repeated access to same identifier

Posted by yongjieli on Stack Overflow See other posts from Stack Overflow or by yongjieli
Published on 2010-06-14T05:34:41Z Indexed on 2010/06/14 5:42 UTC
Read the original article Hit count: 119

Filed under:

Hi all

I wanted to ask if there is a formal way of describing the following code, whereby we can access the same object repeatedly without re-typing the object's identifier:

myObj.render(1).render(2).print();

I didn't know how to describe it when trying to form a question; I wanted to know whether or not something like this is possible in javascript, I know that I can do it in VB:

myObj.render(1)
    if(foo == 'bar')
        .render(2)
    .print();

Thanks!

© Stack Overflow or respective owner

Related posts about JavaScript