Use the continue statement to not output the array's element "Java".
var nameList = ["Json", "XML", "Java", "Ford"]; var text = "" var i; for (i = 0; i < nameList.length; i++) { //your code here text += nameList[i] + "\n"; } console.log( text );
Insert an if statement which checks if nameList[i] === "Java", then add continue;
var nameList = ["Json", "XML", "Java", "Ford"]; var text = "" var i;/*from w w w .j av a 2 s . c om*/ for (i = 0; i < nameList.length; i++) { if (nameList[i] === "Java") continue; text += nameList[i] + "\n"; } console.log( text );