Skip to content
Open

Done #2117

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
function takeANumber(line, name){
line.push(name)
return (`Welcome, ${name}. You are number ${line.length} in line.`)
}

function nowServing(katzDeliLine) {
if (katzDeliLine.length > 0){
return (`Currently serving ` + katzDeliLine.shift() + `.`)}
else {
return ("There is nobody waiting to be served!")}
}

function currentLine(line) {
if (line.length > 0) {
return (`The line is currently: 1. ${line[0]}, 2. ${line[1]}, 3. ${line[2]}`)
}
else {
return ('The line is currently empty.')}
}


function currentLine(line) {
let output;
if (line.length === 0) {
output = `The line is currently empty.`
}
else {
output = `The line is currently: `
for(let i = 0; i < line.length; i++){
if (i === 0){
output = output + (i+1) + `. ` + `${line[i]}`;
}
else {
output = output + `, ` + (i+1) + `. ` + `${line[i]}`;}
}
}
return output
}