In perl, I can do this:
{ foo => 1, condition ? (bar => 2) : () }
The result will be either { foo => 1 }
or { foo => 1, bar => 2 }
depending on condition
.
Is something like this possible with javascript objects?
Blancer.com Tutorials and projects
Freelance Projects, Design and Programming Tutorials
In perl, I can do this:
{ foo => 1, condition ? (bar => 2) : () }
The result will be either { foo => 1 }
or { foo => 1, bar => 2 }
depending on condition
.
Is something like this possible with javascript objects?