Is this some sort of javascript array initialization and why?

I'm working through a javascript(node.js) example that saves to a mongodb db store.

I've come across a snippet of code and I can't quite understand what exactly the writer of the tutorial is trying to do and why. It's just my lack of understanding, but I'd really like to know what's going on here. Please see code below with my comments next to lines in question:

  //save new employee
  EmployeeProvider.prototype.save = function(employees, callback) {
      this.getCollection(function(error, employee_collection) {
        if( error ) callback(error)
        else {

          // This is the portion I have a question on. 
          // So this is checking to see if the array.length is undefined? Why would the length property be undefined?
          if( typeof(employees.length)=="undefined")
            // What is going on here exactly? 
            // It looks like he is initializing and array with employees parameter that was passed in to the save 
            // function earlier? I've never seen this kind of thing done before. Thoughts?
            employees = [employees];

          for( var i =0;i< employees.length;i++ ) {
            employee = employees[i];
            employee.created_at = new Date();
          }

          employee_collection.insert(employees, function() {
            callback(null, employees);
          });
        }
      });
  };

Thanks for any help!

Chris

Looks like the intention there is to allow the employees parameter to be a single employee, or an array of employees. If a single employee object is passed, it gets turned into a one element array.

The if statement and its content (the first line below it) basically says: "if employees is not an array, create a new array with that name, containing what was passed in". This guarantees that, from that point on, employees will be an array.