In java it is common to call methods without explicitly declaring objects for them.
eg: new Foo().bar("foobar");
I am new to javascript, it is fair enof to call it the same way ?
- Is
new Foo().bar("foobar");allowed in javascript
OR
Do I need to declare a variable
var foo = new Foo(); foo.bar("foobar"); ?