Version 1: Just say each person

console.log('Hi Sarah');
console.log('Hi Jose');
console.log('Hi Orhan');

Version 2: Just say each person by saying hello to their index in the array

const people = ['Sarah', 'Jose', 'Orhan'];

console.log('Hello ' + people[0]);
console.log('Hello ' + people[1]);
console.log('Hello ' + people[2]);

Version 3: Loop over the array

const people = ['Sarah', 'Jose', 'Orhan'];

for ( var i = 0; i < people.length; i++ ){
  console.log('Hi ' + people[i]);
}
All three should have the same output in the console:
"Hi Sarah"
"Hi Jose"
"Hi Orhan"

results matching ""

    No results matching ""