Coursera Javascript Issue

Im running into a bit of a roadblock with our assignment, and I’m wondering if anyone has some ideas for a workaround. The approach I’ve been trying doesn’t seem to be working as expected. I’ve looked over the code, but I think we might need to rethink how we’re tackling this.

Does anyone have any suggestions or alternative methods that could get me back on track? Appreciate any help!

Thanks!

Here is my current code in JS

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

}

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(message, style);
     }
}

consoleStyler('#1d5c63', '#ede6db', '40px',  'Congrats!');
celebrateStyler('birthday');

function styleAndCelebrate(color, background, fontSize, txt, reason) {
    consoleStyler(color, background, fontSize, txt);  
    celebrateStyler(reason);

}

styleAndCelebrate ('ef7c8e', 'fae8e0', '30px','You made it!', 'champions');

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like

what are the requirements for this code? what errors are you getting? what have you tried to solve it?

Thank you appreciate it

please do not post screenshots, it’s quite difficult to read

Can you please try formatting your code using the instructions above?