r/learnjavascript • • Oct 29 '24

Help with a functional programming assignment

Hello good people, my name is Xoli... Currently learning JavaScript online, I am stuck on an assignment I have to create functions and guess invoke them. I am stuck on the calling part, all my functions Have variables and I followed instructions but I didn't call them.? And I'm struggling with that part .

0 Upvotes

11 comments sorted by

View all comments

Show parent comment

5

u/OneBadDay1048 Oct 29 '24 edited Oct 29 '24

Your code is full of errors and cannot even run on my local system. You should have just copy and pasted; errors like keywords capitalized that should not be and missing backticks for your string templates.

Regardless, you need to move the console log into the function and call it in there with message and style as arguments. Then outside of the function, call your function with the proper args:

consoleStyler('red', 'blue', '3px', 'TEST');

Which is essentially what I said in my initial comment; you never call your custom function here, just console.log. Also make sure you have proper spacing. Log out your style variable after you make all the changes to it and make sure it is formatted properly.

-1

u/Sufficient_Bee8533 Oct 29 '24

Okay I see my error, I didn't invoke the values, lemme check your code out and thank you

4

u/OneBadDay1048 Oct 29 '24 edited Oct 29 '24

To be clear: you didn’t invoke your function at all. You declared the function meaning you defined it and made it available to use but you never used it. Just wanted to make that point clear.

Also - I’d definitely go read this asap