Skip to content

Instantly share code, notes, and snippets.

@logosity
Last active December 17, 2015 16:28
Show Gist options
  • Save logosity/5638563 to your computer and use it in GitHub Desktop.
Save logosity/5638563 to your computer and use it in GitHub Desktop.
function listFruits(fs) {
fs.sort();
for(var i in fs) {
console.log(fs[i]);
}
}
var fruits = ["Banana", "Orange", "Apple", "Mango"];
listFruits(fruits); //prints Apple Banana Mango Orange each on their own line
console.log(fruits); //["Apple", "Banana", "Mango", "Orange"] ouch!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment