r/JavaScriptTips • • Jul 08 '23

HELP WITH CODING ROOMS

I’m doing the coding rooms free course and I’m stuck on this assignment. Instructions in the picture. Any help is appreciated

3 Upvotes

4 comments sorted by

1

u/[deleted] Jul 08 '23

Use default parameters in function rather than using if else

0

u/Key_Safety8433 Jul 08 '23

Idk what default parameters are💀

1

u/velo2002 Oct 30 '23

Welcome to coding rooms, it fucking sucks, you’ll turn in a project where every piece of code works 100% and it’ll say nothjng works at all, not sure wtf they’re using to test the code but it’s outdated asf

1

u/slam_the_damn_door Jul 08 '23

function greetByDefault(firstname, lastname){ if(lastname === undefined) lastname ='Doe';

return `Hi ${firstname} ${lastname}!'; }

Something like above, or if you wanna use defualt params:

function greetByDefault(firstname, lastname='doe'){ return `Hi ${firstname} ${lastname}!'; }