Tuesday, August 19, 2014

Previous Interview Question Next Interview Question
Home

which of the following indicates what is wrong with the function below?

function valuechecker(){
if(isNaN(x))return;
if(x<10){
alert(“There are less than 10 items”);
}
else {
alert(“There are more than 10 items”);
}
}

   a)      This code won’t execute because you can’t have a capital letter in a function name
   b)      The browser won’t be able to interpret the code because the curly braces have to be on their      own lines
   c)       There is a logic error in that there could be exactly 10 items and there is no code or text for        that condition
   d)      This is a poor code because the alert{} doen’t work on all browsers and will give an error on      some of them

Answer :  B

Previous Interview Question Next Interview Question
Home

1 comments :