Question: ```
<div id="id1">Click to know</div>

<script>
function Superheroe(power){
    this.power=power;
}
//edited: copy mistake solved
Superheroe.prototype.sayYourPower=function(){
    alert('This is my power :'+ this.power);
}

var Mike = new Superheroe ("Code fast");

document.getElementById('id1').addEventListener("click",Mike.sayYourPower);
</script>

```

I'm wonder why I'm getting 'undefined' when I ask for the sayYourPower...It is for not including the "()" at the end of the method?

Answer: 
I assume you want these variables as arguments, because you don't set them anywhere. The correct syntax is:

```
Alter Procedure rpt_1 (
    @FromDate Datetime,
    @ToDate Datetime,
    @LocId int
) as
Begin
    select 
        cl.CashLocationName, 
        convert(date,fn.DocumentDate) DocumentDate, 
        u.UserName,
        sum(TotalPayment) TotalVanzare, sum(CashAmount) TotalCash, 
        sum(CardAmount) TotalCard, sum(TicketPaymentAmount) TotalTichete, 
        sum(VATAmount)as TVA,
        count(FiscalNoteId) as NrBon, 
        round(sum(TotalPayment) / count(FiscalNoteId), 2) as ValoareMedieCos, 
        max(InternalTime) as MomentInchidere
    from 
        FiscalNote fn (nolock)
    Join 
        CashLocation cl (nolock) on cl.CashLocationId = fn.CashLocationId
    Join 
        ERPUser u (nolock) on u.UserId = fn.UserId  
    join 
        Site s (nolock) on s.SiteId = fn.SiteId
    where 
        DocumentDate >= @FromDate and DocumentDate <= @ToDate 
        and s.SiteId = @LocId  
        and fn.DocumentStateId = 36
    group by 
        cl.CashLocationName, fn.DocumentDate, OpenCashLocationMovementId, 
        u.UserName
    order by 
        DocumentDate,  CashLocationName, UserName
end;

```
Because you are using the @fromdate and @todate variables without initializing them.Either you should you it as input parameter to the procedure and provide values while calling the procedure or initialize in the procedure.

```
Alter Procedure rpt_1 
@FromDate Datetime,
@ToDate Datetime,
@LocId int

 as
 Begin
    -----

 end

```

OR

```
Alter Procedure rpt_1
as

declare @FromDate Datetime 
declare @ToDate Datetime
declare @LocId int
--initialize here

```