title: Jasmine: TypeError: Cannot read property 'toLowerCase' of undefined
body: <p>I am having a function which checks if name exists in an array (names_array). If exists return true else if not then push the name to names_array and create table rows for each name and append to table.</p>
  
  <p>Using Jasmine I have to test if the function is returning true or false.
  For this I am passing values for variables names_array and name.
  But still getting undefined variable error for the code $('#add_name').val();</p>
  
  <p>My javascript code to test is...</p>
  
  <pre><code>function check_names(names_array) {
      var name = $('#add_name').val().toLowerCase();
      //check if name is there in names_array if yes return true, if not then return false and push the item to the names_array
      }
  </code></pre>
  
  <p>Jasmine code which I am using..</p>
  
  <pre><code>describe("On Name Create",function (){
  var names_array = ["add","bad","sad","dad"];
     it("Check for names",function (){
          var name = "add";
          expect(check_names(names_array)).toBeTruthy();
     });
   });
  </code></pre>
  
  <p>Am I missing something as I am new to Jasmine?</p>