Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

158
Vistas
Odin project's task to make a function 'capitalize' and I have no idea if my answer is any good?

So I've been doing the Odin Project and I'm at functions right now and there's a task "Write a function called capitalize that takes a string and returns that string with only the first letter capitalized. Make sure that it can take strings that are lowercase, UPPERCASE or BoTh."

<script>
     

     function capitalize(myName, myNameUpper, myNameRan) {
     const toUpper = "Bartek";
     myName = "bartek";
     myNameUpper = "BARTEK";
     myNameRan = "BaRtEk";
     myName, myNameUpper, myNameRan = toUpper;
     console.log(myName, myNameUpper, myNameRan)
     
     }

     capitalize();
    
    
     
      </script>

Is my function any good? Thanks in advance for help.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

<script>
     

     function capitalize(lowercase,uppercase,both ) {
     const capitalizeLower = lowercase.charAt(0).toUpperCase() + lowercase.slice(1).toLowerCase();
     const capitalizeUpper = uppercase.charAt(0).toUpperCase() + uppercase.slice(1).toLowerCase();
     const capitalizeBoth = both.charAt(0).toUpperCase() + both.slice(1).toLowerCase();
     console.log(capitalizeLower, capitalizeUpper , capitalizeBoth)
     return `${capitalizeLower} ${capitalizeUpper} ${capitalizeBoth}`
     }

     capitalize("hello","HELLO","hEllO");
    
    
     
      </script>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda