Unable to call object properties that are functions
See original GitHub issueThe following code produces a parsing error when run on the playground
ask {
const sum = fun(a, b) {
a + b
}
const diff = fun(a, b) {
a - b
}
const myMath = { sum, diff }
myMath.sum(2, 2)
}
It works fine, when myMath
is destructured first:
const s = myMath.sum
s(2,2)
Used expression (myMath.sum(2, 2)
) should be translated into
<call
args={
<list>
{2}
{2}
</list>
}
>
<call
name="at"
args={
<list>
<ref name="myMath" />
{"sum"}
</list>
}
/>
</call>
Note that call
in AskJSX can accept either the name
property in args or function expression in its first child.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7
Top Results From Across the Web
Unable to call object properties from functions in JavaScript
Easy fix: There is really no reason to call y:(height/2)-(batHeight/2),. since you are defining batHeight two lines above it.
Read more >Working with objects - JavaScript - MDN Web Docs - Mozilla
An object is a collection of properties, and a property is an association between a name (or key) and a value. A property's...
Read more >Function object, NFE - The Modern JavaScript Tutorial
In JavaScript, functions are objects. A good way to imagine functions is as callable “action objects”. We can not only call them, but...
Read more >How to call a Function inside an Object in JavaScript
You can call a function inside an object by declaring the function as a property on the object and invoking it, e.g. obj.sum(2,...
Read more >emscripten::val - Unable to call function inside property of ...
I have Global JavaScript object structured like below, ` foo Object > gee property >> nee() function >> zee() function ` I used...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ack. I will try to reply tomorrow.
@lukasz-xfaang i’ve stuck on this 😦 I really need your help @lukasz-xfaang @czerwinskilukasz1