Aside

Gist Test

Paste the url:

singleDigitSum = function( number){
if(number % 9 === 0){
return 9;
}
else{
return number % 9;
}
};
do{
var number = prompt("Enter number to find single digit sum.Enter 'q' to quit.");
if(number.length > 0 && isNaN(number)===false)
alert("Single digit sum of " + number + " is: "+ singleDigitSum(number));
else if(number!== 'q')
alert("Please enter a numeric value.");
} while(number !== 'q');

Shortcode:

singleDigitSum = function( number){
if(number % 9 === 0){
return 9;
}
else{
return number % 9;
}
};
do{
var number = prompt("Enter number to find single digit sum.Enter 'q' to quit.");
if(number.length > 0 && isNaN(number)===false)
alert("Single digit sum of " + number + " is: "+ singleDigitSum(number));
else if(number!== 'q')
alert("Please enter a numeric value.");
} while(number !== 'q');

Code
singleDigitSum = function( number){
if(number % 9 === 0){
return 9;
}
else{
return number % 9;
}
};
do{
var number = prompt("Enter number to find single digit sum.Enter 'q' to quit.");
if(number.length > 0 && isNaN(number)===false)
alert("Single digit sum of " + number + " is: "+ singleDigitSum(number));
else if(number!== 'q')
alert("Please enter a numeric value.");
} while(number !== 'q');