It's because of javascript's hoisting
function() {
var speakService = speakService();
return speakService;
}
Will be same as
function() {
var speakService; //Declaration moved to top
speakService = speakService(); //here speakService is undefined
return speakService;
}