Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 16210

Here Is my error for the my javascript code [closed]

$
0
0

I attempt one javascript assignment and there is four task which I mentioned in my code. but somehow I am getting problem in my 2nd task.where I have to make function but I didn't get idea what is going wrong.

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

Here is my 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(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(color, background, fontSize, txt,reason) {   consoleStyler(color, background, fontSize, txt);    celebrateStyler(reason);}

// Call styleAndCelebrate

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

Viewing all articles
Browse latest Browse all 16210

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>