結果 : call function inside if statement javascript