Build a function currentLine that accepts the current line of people and returns the current line as a string; for example, if 'katzDeliLine' is currently ["Ada", "Grace"], currentLine(katzDeliLine) would return "The line is currently: 1. Ada, 2. Grace". You don't have to use katzDeliLine as a variable or parameter name in your function though, it's just an example of a variable that might be passed to it. If there is nobody in line, it should return "The line is currently empty."
I have tried quite a few different codes and have been experimenting for a while...
function currentLine(line) {
if (line.length > 0)
return `The line is currently ${line}.`;
else {
return 'The line is currently empty.';
}
}
1) deli currentLine(line) says who is in line when there are people waiting:
Error: Expected 'The line is currently Bill,Jane,Ann.'
to equal
'The line is currently: 1. Bill, 2. Jane, 3. Ann'
+ expected - actual
-The line is currently Bill,Jane,Ann.
+The line is currently: 1. Bill, 2. Jane, 3. Ann
Aucun commentaire:
Enregistrer un commentaire