Last active
January 2, 2016 16:29
-
-
Save lizkaraffa/8330140 to your computer and use it in GitHub Desktop.
Here is the challenge: Sort the 'saying2' array, on about line 19, so that the words are listed in length order. The shortest first. Use the 'length' property on the strings in the sort function. So I did it and then this is the error message they're giving me: Bummer! The 'saying2' was 'The,quick,brown,fox,jumped,over,the,lazy,dog's,back' not '…
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title> JavaScript Foundations: Arrays</title> | |
<style> | |
html { | |
background: #FAFAFA; | |
font-family: sans-serif; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>JavaScript Foundations</h1> | |
<h2>Arrays: Methods Part 1</h2> | |
<script> | |
var saying1 = ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"]; | |
var saying2 = ["The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog's", "back"]; | |
saying1.reverse(); | |
saying2.sort(function(a, b){ | |
return a.length > b.length; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment