//ARRAY TO STORE NAMES
var names = ["Alice", "Susan", "Jake", "Bill"];
//FOR LOOP TO GET KEYS OF NAMES ARRAY.
for (var i = 0; i<names.length; i++) {
allNames = names;
if (names* == "Bill") {
names_txt.text = "Hello "+names*;
} else {
names_txt.text += names*+"
";
}
}
In the above exercise I’m attempting if the name==“Bill” output hello + bill and the remaining names to the textfield
ie.
Alice
Susan
Jake
Hello Bill
But I’m only getting “Hello Bill” I also want the same results with any element in the array.
ie
alice
Hello Susan
Jake
Bill
What have I goofed?