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');

Published by Chaitanya

I am a family man, perpetual learner, and Happiness Engineer at Automattic. I appreciate flat white coffee, avocado toast, haute desserts and other fine foods. I also read, write, move, and meditate. Oh, I also flip-flop and iterate a lot!

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: