Prompt not working

I have a problem in my code somewhere in the var myAge (first line). I have loaded the browser up but cannot get the prompt window to open. Any thoughts on what's wrong with the code?

 <script>
var myAge = parseInt( prompt("enter your age", 30), 10 );

if (myAge >= 0 && myAge <= 10) {
    document.write("myAge is between 0 and 10 <br/>");
}

if ( !(myAge >= 0 && myAge <= 10) {
    document.write("myAge is NOT between 0 and 10 <br/>");  
}

if (myAge >= 80 || myAge <= 10) {
    document.write("myAge is 80 or above OR 10 or below.<br/>");    
}

if ( (myAge >= 30 && myAge <= 39) || (myAge >= 80 && myAge <= 89) ) {
    document.write("myAge is between 30 and 39 and 39 or myAge is " + "between 80 and 88"); 
}
</script>

Answers


you missed a paranthesis in the second-if block..... also close the script tag.

var myAge = parseInt( prompt("enter your age", 30), 10 );

if (myAge >= 0 && myAge <= 10) {
    document.write("myAge is between 0 and 10 <br/>");
}

if ( !(myAge >= 0 && myAge <= 10)) {
    document.write("myAge is NOT between 0 and 10 <br/>");  
}

if (myAge >= 80 || myAge <= 10) {
    document.write("myAge is 80 or above OR 10 or below.<br/>");    
}

if ( (myAge >= 30 && myAge <= 39) || (myAge >= 80 && myAge <= 89) ) {
    document.write("myAge is between 30 and 39 and 39 or myAge is " + "between 80 and 88"); 
}

Need Your Help

Will several bindings of static/global Event handler to Events in a class, lead to a thread/memory leak?

c# multithreading memory-leaks event-handling

I have a class with EventHandler bindings at the constructor, that will be instantiated thousand times within application lifecycle. The question is: Will this approach leads to memory/thread leaks...

Reading hyperlink information from an excel file using .NET

.net asp.net excel hyperlink

I am reading an excel file in C#.NET. The data is being read successfully but there is problem with some hyperlinks stored in the excel file.