From 3c0d504df6478252d68fb9ce80874b24650ada8d Mon Sep 17 00:00:00 2001 From: Eric Uberman Date: Thu, 10 Sep 2020 16:47:30 +0000 Subject: [PATCH 1/2] Done. --- index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/index.js b/index.js index e69de29bb2..374ec75ea9 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,26 @@ +function takeANumber(katzDeliLine,newCustomer) { + katzDeliLine.push(newCustomer); + var spotInLine = katzDeliLine.indexOf(newCustomer); + spotInLine++; + var greeting = "Welcome, " + newCustomer + ". You are number " + spotInLine + " in line."; + return greeting; +} + +function nowServing(katzDeliLine) { + var firstCustomer = katzDeliLine.shift(); + var str = "Currently serving " + firstCustomer + "."; + var result = firstCustomer ? str : "There is nobody waiting to be served!"; + return result; +} + +function currentLine(katzDeliLine) { + var str = "The line is currently: "; + var customerList = []; + + for (let i = 0; i < katzDeliLine.length; i++) { + customerList.push((i + 1) + ". " + katzDeliLine[i]); + } + var resultStr = "The line is currently: " + customerList.join(", "); + var result = (katzDeliLine.length > 0) ? resultStr : "The line is currently empty."; + return result; +} \ No newline at end of file From e24d04c4b7e6837192fbd3b824533ae5edead552 Mon Sep 17 00:00:00 2001 From: Eric Uberman Date: Wed, 16 Sep 2020 17:44:11 +0000 Subject: [PATCH 2/2] Done. --- index.js | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/index.js b/index.js index 374ec75ea9..75e70ef1df 100644 --- a/index.js +++ b/index.js @@ -1,26 +1,26 @@ -function takeANumber(katzDeliLine,newCustomer) { - katzDeliLine.push(newCustomer); - var spotInLine = katzDeliLine.indexOf(newCustomer); - spotInLine++; - var greeting = "Welcome, " + newCustomer + ". You are number " + spotInLine + " in line."; - return greeting; -} - -function nowServing(katzDeliLine) { - var firstCustomer = katzDeliLine.shift(); - var str = "Currently serving " + firstCustomer + "."; - var result = firstCustomer ? str : "There is nobody waiting to be served!"; - return result; -} - -function currentLine(katzDeliLine) { - var str = "The line is currently: "; - var customerList = []; - - for (let i = 0; i < katzDeliLine.length; i++) { - customerList.push((i + 1) + ". " + katzDeliLine[i]); - } - var resultStr = "The line is currently: " + customerList.join(", "); - var result = (katzDeliLine.length > 0) ? resultStr : "The line is currently empty."; - return result; +function takeANumber(katzDeliLine,newCustomer) { + katzDeliLine.push(newCustomer); + var spotInLine = katzDeliLine.indexOf(newCustomer); + spotInLine++; + var greeting = "Welcome, " + newCustomer + ". You are number " + spotInLine + " in line."; + return greeting; +} + +function nowServing(katzDeliLine) { + var firstCustomer = katzDeliLine.shift(); + var str = "Currently serving " + firstCustomer + "."; + var result = firstCustomer ? str : "There is nobody waiting to be served!"; + return result; +} + +function currentLine(katzDeliLine) { + var str = "The line is currently: "; + var customerList = []; + + for (let i = 0; i < katzDeliLine.length; i++) { + customerList.push((i + 1) + ". " + katzDeliLine[i]); + } + var resultStr = "The line is currently: " + customerList.join(", "); + var result = (katzDeliLine.length > 0) ? resultStr : "The line is currently empty."; + return result; } \ No newline at end of file