Arrays in Javascript - 00014
Adem Deliaslan
Posted on October 23, 2019
// Arrays!
//ignore xPos and yPos.
var myFriend = "Sophia";
var myFriends = ["Sophia", "John", "Leif", "Winston", "OhNoes Guy!!"];
// myFriends[1]
fill(255, 0, 0);
text( myFriends[0], 10, 30);
Output: Sophia
text( myFriends[1], 10, 80);
Output: John
text( myFriends[2], 10, 130);
Output: Leif
text("I have " + myFriends.length + " friends!!!", 10, 150);
Output: I have 5 friends!!!
💖 💪 🙅 🚩
Adem Deliaslan
Posted on October 23, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.