// app.lunchCheckController.js

/**
 * If the number of items in the textbox is less than or equal to 3
 * (e.g., 1, 2, or 3), a message should show up under to the textbox
 * saying "Enjoy!". If the number of items is greater than 3
 * (4, 5, and above), the message "Too much!" should show up under
 * the textbox.
 *
 * If the textbox is empty and the user clicks the "Check If Too Much" button,
 * the message "Please enter data first" should show up. 'Empty' here means
 * either "" (empty string) or a string with just spaces in it.
 *
 * Only 1 message should be shown at any given time. In other words,
 * if you have both messages "Enjoy!" and "Too much!" showing up at the same time,
 * it's an error.
 *
 * You are not required to handle a case where there is no item between some commas.
 * For example, you are free to consider this case item 1, item2,,item3 or this case
 * item 1, item2, ,item3 as 4 items in the list. However, you can implement checking for
 * an 'empty' item as a bonus feature (ungraded). Please make sure to put a comment
 * somewhere next to the input textbox stating that you do NOT consider and empty item,
 * i.e., , , as an item towards to the count.
 *
 * item1, item2, item3
 */

(function() {
  "use strict";

  angular.module("LunchCheck")
    .controller("LunchCheckController", LunchCheckController);

  function LunchCheckController() {
    let vm = this;

    const ENJOY_MESSAGE = "Enjoy!";
    const TOO_MUCH_MESSAGE = "Too much!";
    const ENTER_DATA_MESSAGE = "Please enter data first!";
    const EMPTY_ITEMS_MESSAGE = "Empty items. Please try again!";
    const ACCEPTABLE_COUNT = 3;

    vm.onLunchMenuCheck = onLunchMenuCheck;
    vm.infoMessage = "";

    function checkData() {
      if (!vm.lunchMenu) {
        vm.infoMessage = ENTER_DATA_MESSAGE;

        return;
      }

      checkCount();
    }

    function checkCount() {
      const check = checkDataItems(vm.lunchMenu.split(","));

      console.log("checkCount", check);

      if (!!check) {
        return;
      }

      const data = vm.lunchMenu.split(",");
      const dataSize = data.length;

      console.log(data);

      if (dataSize <= ACCEPTABLE_COUNT) {
        vm.infoMessage = ENJOY_MESSAGE;
      } else {
        vm.infoMessage = TOO_MUCH_MESSAGE;
      }

      return;
    }

    function checItemLength(item) {
      return item.length === 0;
    }

    function checkDataItems(arr) {
      const check = arr.some(checItemLength);

      if (check) {
        console.log("checkkkkk");

        vm.infoMessage = EMPTY_ITEMS_MESSAGE;

        return -1;
      }
    }

    function onLunchMenuCheck() {
      checkData();
    }
  }
})();

@@ -27,24 +27,27 @@
 r.js%0A%0A/**%0A *
+ 1.
  If the numb
@@ -100,16 +100,16 @@
 al to 3%0A
-
  * (e.g.
@@ -318,16 +318,19 @@
 x.%0A *%0A *
+ 2.
  If the 
@@ -543,16 +543,19 @@
 t.%0A *%0A *
+ 3.
  Only 1 
@@ -719,16 +719,19 @@
 r.%0A *%0A *
+ 4.
  You are
@@ -1739,24 +1739,35 @@
 eckData() %7B%0A
+      // 2%0A
       if (!v
@@ -1973,49 +1973,8 @@
 );%0A%0A
-      console.log(%22checkCount%22, check);%0A%0A
     
@@ -2106,27 +2106,15 @@
     
-console.log(data);%0A
+// 1, 3
 %0A   
@@ -2272,32 +2272,112 @@
  return;%0A    %7D%0A%0A
+    /**%0A     *%0A     * @param %7B*%7D item - array item, comes from ng-model%0A     */%0A
     function che
@@ -2427,32 +2427,103 @@
 h === 0;%0A    %7D%0A%0A
+    /**%0A     *%0A     * @param %7B*%7D arr - ng-model data%0A     */%0A%0A    // 4%0A
     function che
@@ -2584,24 +2584,24 @@
 emLength);%0A%0A
+
       if (ch
@@ -2611,43 +2611,8 @@
 ) %7B%0A
-        console.log(%22checkkkkk%22);%0A%0A
     

Delete useless code. Added comments