//sample solution
//Create an object called FizzBuzzPlus
var FizzBuzzPlus = new Object();
//create the following functions:
// isFizzBuzzie
// return true if the provided value is
// a multiple of 3 or 5 but not both 3 and 5.
// otherwise it returns false
// arguments: number - integer
// returns: true or false - boolean
FizzBuzzPlus.isFizzBuzzie = function(someValue){
if(someValue%3===0 && someValue%5===0){
return false;
} else if(someValue%3===0 || someValue%5===0){
return true;
} else {
return false;
}
}
//test
console.log(FizzBuzzPlus.isFizzBuzzie(8));
console.log(FizzBuzzPlus.isFizzBuzzie(3));
console.log(FizzBuzzPlus.isFizzBuzzie(15));
No comments:
Post a Comment