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

135
Views
How do I do this javascript question about a student greet?
var students = ["Brandon", "Daniel"];

var greetStudent = "Hello, ${students[1]}"

for (let i = 0; i < students.length; i++) {
  greetStudent(students[i]);
}

for (let student of students) {
  greetStudent(student);
}

How do I get it to show with console.log " Daniel" as it is ${students[1]}?

I'm a starter in javascript. Please help me, I would appreciate it!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

greetStudent has to be a function, not a variable since you are calling it.

const greetStudent = (student) => {
    console.log(`Hello, ${student}`)
}
about 4 years ago · Juan Pablo Isaza Report

0

Define greetStudent as a function and use a template literal instead of a regular string.

let students = ["Brandon", "Daniel"];

const greetStudent = student => `Hello, ${student}`;

for (let i = 0; i < students.length; i++){
  console.log(greetStudent(students[i]));
}

for (let student of students){
  console.log(greetStudent(student));
}

about 4 years ago · Juan Pablo Isaza 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!