Loops in array n loop



Let's replace your current code with a loop.

Write a for loop that loops through your vacationSpots array.

Inside the block of the for loop, use console.log to print each item in the vacationSpots array.

var vacationSpots = ['jsr', 'ngp', 'Barcelona','saagr','sd'];

for (var i = 0; i < vacationSpots.length; i++)
  console.log( vacationSpots[i]);

can someone tell me ..what is wrong with the code


What error are you getting?

Write a function called nameString()
It should take name as a parameter.
The function returns a string equal to "Hi, I am" + " " + name.
Call nameString() by passing it your name, and use console.log to print the output.

var nameString = function(name)
console.log("Hi, I am" + " " + name);


what is wrong here?


You are forgetting the period maybe?

console.log("Hi, I am" + " " + name + ".");