Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

271
Visualizações
Can you highlight where I've gone wrong

I've been working on this for over 12 hours.

I really enjoy coding but I'm very bad at it.

Could you please highlight in red where I've gone wrong in this code?

(function (window) {
var names = {"Yaakov", "John", "Jen", "Jason", "Paul", "Frank", "Larry", "Paula", "Laura", "Jim"};
for (let i = 0; i < names.length; i++) {
if (firstLetter === 'j')  || 'J'{
    byeSpeaker.speak(names[i]);
  } else {
    helloSpeaker.speak(names[i]);
  } 
}

})(window);

(function (window) {

var speakWord = "Hello";

var helloSpeaker = speakWord;

helloSpeaker.speak(name) = fuction () 
    
(speakWord + " " + name);

window.helloSpeaker = helloSpeaker;
console.log(window);})

(function (window) {

var speakWord = "Good Bye";

var byeSpeaker = speakWord;

byeSpeaker.speak(name) = function () {
    
(speakWord + " " + name);}

window.byeSpeaker = byeSpeaker;

console.log(window);})
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Module 4 Solution Starter</title>
  <script src="SpeakHello.js"></script>
  <script src="SpeakGoodBye.js"></script>
  <script src="script.js"></script>
</head>
<body>
  <h1>Module 4 Solution Starter</h1>
</body>
</html>

It's supposed to loop for hello name but goodbye for names beginning with J.

If you can provide more feedback I would be grateful.

Thanks in advance.

Natasha

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Your first if statement is bad. It should be like this:

if (firstLetter === 'j' || firstLetter === 'J') {
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda