[SalesForce] NaN issue in aura:method

I have a aura:method the return value from parent is NaN.

Why is my code returning NaN?

child component

<aura:method name="myAction"
                 action="{!c.myAction}"
                   access="public">
       <aura:attribute name="num1" 
       <aura:attribute name="num2" 
        var params=event.getParam("arguments");
        if (params)
        {
           var par1=params.num1;
            var par2=params.num2;
            var output=parseInt(par1)+parseInt(par2);}

Inside the parent component I have like this as below

 <c:AuraMethodChild aura:id="ChildComp"/>
 <lightning:button label="ClickMe"
                    onclick="{!c.ClickMe}"/>
 var findchild = component.find('ChildComp');
 var rtnMsgFromChildMethod = parseInt(findchild.myAction());

Best Answer

You are not returning result from the ChildComp controller method. Use below after closing of if statement

return output;

Check Salesforce Doc https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_cmp_methods_sync.htm