Created
January 18, 2019 23:47
-
-
Save joshuaaguilar20/f718aea09b2bb72135f1242b2a5e9a79 to your computer and use it in GitHub Desktop.
mitchNotes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var names = ["josh", "bree", "mitch", "mohommad", "john", "jr", | |
"nacy", "donald","player3" | |
]; | |
//loop through names and print mohommad | |
function find(group, name){ | |
//checks everyname in List | |
for (var i = 0; i < group.length; i++) | |
{ | |
if(group[i] == name) //if group[0,1,2,3,4,5,6] | |
{ | |
var nameFound = console.log(group[i]) | |
} | |
else console.log(i); | |
} | |
return nameFound | |
}; | |
find(names, "mitch") | |
var friends = ["joe", "bill", "fred", "al", "tim"]; | |
var friendFound; | |
function find(Team1, name){ | |
for (var i=0;i < Team1.length;i++){ | |
if(Team1[i]== name){ | |
friendFound = Team1[i] | |
} | |
// else{ | |
// console.log("Incorrect") | |
// } | |
} | |
return friendFound | |
}; | |
var found = find(friends,"joe") | |
console.log(found); | |
//index 0 //index[1] | |
var books = ["The Odyssey", "The Bible", "The Koran", "The Torah", "Treasure Island","test"] | |
//print test = | |
var total = books.length | |
var book4 = books[3] | |
books[0] = "something else" | |
books[1] = "nothing" | |
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push | |
//log something else | |
//.push adds item to variable list | |
books.push("Test2") | |
console.log(books) | |
//.pop removes | |
books.pop("test"); | |
console.log(books) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment