Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var saludar = function(nombreORepeticiones, mensaje) {
- mensaje = mensaje || 'Hola';
- if (typeof(nombreORepeticiones) == 'string') {
- _saludarPersona(nombreORepeticiones, mensaje);
- } else {
- _saludarRepeticiones(nombreORepeticiones, mensaje);
- }
- }
- function _saludarPersona(nombre, mensaje) {
- console.log(nombre+ ': ' + mensaje);
- }
- function _saludarRepeticiones(repeticiones, mensaje) {
- for (var i=0; i < repeticiones; i++) {
- console.log(mensaje);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement