Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

258
Views
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 answers
Answer question

0

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

if (firstLetter === 'j' || firstLetter === 'J') {
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!