Reputation: 17876
I have a coffee script function
postData: (pattern) ->
myData =
a: "a string"
pattern: 0
f: false
It is evaluated as
{
"a": "a string",
"pattern": 0,
"f": false
}
It is not what I want. I would like pattern
to be a string I passed in
Thanks for any help.
Upvotes: 0
Views: 39
Reputation: 9523
postData: (pattern) ->
myData =
a: "a string"
f: false
myData[pattern] = 0
return myData
See it working here.
Upvotes: 1