Coursera Help ! i’m stuck when update update the style variable using the += operator

yeah, you’ve change but stiil there is something that you must change too…
try to look carefully again :sweat_smile:

Wow okay, I’m looking

i’m just guide you here, you have to figure out on your own way :rofl:

this is my solution now

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

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

// 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() {
consoleStyler('ef7c8e', 'fae8eo', '30px', 'You made it');
celebrateStyler('champions');
}
// Call styleAndCelebrate

I’m sorry, i think you should read the instruction from the challenge once again, if i tell you the right code you will not know anything from that challenge :pray:

alright no problem, thanks for tryna help

1 Like

keep strunggle for this challenge :muscle: :muscle:

1 Like

Dear Rahmad, I have the following code for this project, which also fails. Could you instruct me on this?

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','Contrats!');
celebrateStyler('birthday');

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

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

Failed Test 1: Not logging the consoleStyler() variables
Passed Test 2: successfully logged celebrateStyler() variables
Failed Test 3: Not calling consoleStyler() and celebrateStyler()
Failed Test 4: Not calling styleAndCelebrate()
image

image
There is backtick in the code, but not displayed in the reply

I’ve edited your post 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

(post deleted by author)

Dear ilenia,

Thank you so much for your help. I intended to ask you about this question. Could you help me with this code? I can run it thoroughly on the console, but cannot pass the test.

I have no idea what this project it’s about

Thank you all the same.

Hi! Rahmad, I’m also stuck on this problem. Its Meta’s task right?
Please tell me if you got the solution?

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

}

// Task 2: Build another console log message generator
function celebrateStyler(reason) {
    var birthday, champions, message, style;
    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);
    }
}

// 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() {
    consoleStyler('ef7c8e', 'fae8e0', '30px', 'You made it!');
    celebrateStyler('birthday');
}
// Call styleAndCelebrate
styleAndCelebrate();

All you have to do is take a look care each part of your code from above to buttom, if the code don’t run like you now, just look at previous video or reading before…

is it working for you now?

hii i am stuck in the 4th test case the StyleandCelebrate function is not invoking can anyone help

// Task 4: Insert a congratulatory and custom message
function styleAndCelebrate() {
    consoleStyler('ef7c8e', 'fae8e0', '30px', 'You made it!' , 'champion');
    celebrateStyler('birthday');
}
// Call styleAndCelebrate
styleAndCelebrate();