Failed Test 4: Not calling styleAndCelebrate()

Please help me in solving the subject error in the following code. Since it is running perfectly but not working to clear the test 4.

// Task 1: Build a function-based console log message generator
function consoleStyler(color, background, fontSize, txt) {
var message = “%c” + txt;
var style = color: ${color};;
style += background: ${background};;
style += font-size: ${fontSize};;
console.log(message, style);
}
// Task 2: Build another console log message generator
function celebrateStyler(reason) {
if (typeof (reason) != “string”) {
throw TypeError(“reason is not string”);
} try {
var fontStyle = “color: tomato; font-size: 50px”;
if (reason == “birthday”) {
console.log(%cHappy birthday, fontStyle);
} else if (reason == “champions”) {
console.log(%cCongrats on the title, fontStyle);
} else {
console.log(message, style);
}

} catch (error) {
    console.log(error);
}

}

// Task 3: Run both the consoleStyler and the celebrateStyler functions
consoleStyler(‘#1d5c63’, ‘#ede6db’, ‘40px’, ‘Congrats!’);
celebrateStyler(‘birthday’);

// Task 4: Insert a congratulatory and custom messages
function styleAndCelebrate(color, background, fontSize, txt, reason) {
consoleStyler(color, background, fontSize, txt);
celebrateStyler(reason);
}
// Call styleAndCelebrate
styleAndCelebrate(‘#ef7c8e’, ‘#fae8e0’, ‘30px’, ‘You made it!’, ‘champions’);

The instructions are not correct

I was stuck too when I was trying to solve the task.

This is the correct code

// Task 1: Build a function-based console log message generator
function consoleStyler(color,background,fontSize,txt) {
var message = “%c” + txt;
var style = color: ${color};;
style += background: ${background};;
style += font-size: ${fontSize};;
console.log(message , style);
}

// Task 2: Build another console log message generator
function celebrateStyler(reason) {
var fontStyle = “color: tomato; font-size: 50px”;
if (reason == “birthday”) {
console.log(%cHappy birthday, fontStyle);
}
else if(reason == “champions”)
{
console.log(%cCongrats on the title!, fontStyle);
}
else {
console.log(reason, fontStyle);
}
}

// Task 3: Run both the consoleStyler and the celebrateStyler functions
consoleStyler(‘#1d5c63’,‘#ede6db’,‘40px’,‘Congrats!’);
celebrateStyler(‘birthday’);

// Task 4: Insert a congratulatory and custom message
function styleAndCelebrate(color,background,fontSize,txt,reason) {
consoleStyler(color, background, fontSize, txt);
celebrateStyler(reason);
}
// Call styleAndCelebrate
styleAndCelebrate(‘ef7c8e’, ‘fae8e0’, ‘30px’, ‘You made it!’, ‘champions’)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.