function sayHi(who) {
if (!arguments.length) {
console.log('hello');
return;
}
if ( {}.toString.call(who) == '[object Array]' ) {
for (var i = 0; i < who.length; i++) {
sayHi(who[i]);
}
return;
}
console.log('hello ' + who);
}
sayHi( ['Vasya', 'Kolya', 'Sasha'] );