undefined error

i get an error in internet explorer only pointing hello in undefined. how do i resolve it. what am i missing?

<script type="text/javascript">hello.spend();</script>
jcbmttAsked:
Who is Participating?
 
Gurvinder Pal SinghCommented:
it is quite harmless, you can make it more harmless by doing it

var hello = {
    spend =function() {}
};
0
 
Gurvinder Pal SinghCommented:
hello is not defined yet..that is why you get 'undefined error'
0
 
Lalit ChandraCommented:
hello is undefined means that browser is not able to find that hello..
To Understand,change your code with the following line for demonstration only


<script type="text/javascript">

var hello = {
    spend =function() {
          alert("This is the sample only");
     }
}


hello.spend();

</script>

Hope this will fix up your problem.
0
 
jcbmttAuthor Commented:
chandra

is ur function harmless? i dont want the function to do anything. its just to beat the undefined error.
0
 
jcbmttAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.