Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialM F
1,985 PointsWhen I get to task 4 (wordBrown) task 1 stops working and will not let me go on.
When I get to task 4 (wordBrown) task 1 stops working and will not let me go on. What is wrong?
<!DOCTYPE html>
<html lang="en">
<head>
<title> JavaScript Foundations: Strings</title>
<style>
html {
background: #FAFAFA;
font-family: sans-serif;
}
</style>
</head>
<body>
<h1>JavaScript Foundations</h1>
<h2>Strings: Methods</h2>
<script>
var quick = "The quick brown fox jumps over the lazy dog";
var quickLength = quick.length;
var indexOfBrown = quick.indexOf("brown");
var tenthCharacter = quick.charAt(9);
var wordBrown = quick.subStr(10,14);
var quickUpper = quick;
var quickLower = quick;
</script>
</body>
</html>
M F
1,985 PointsThank you so much Antiffia! It is a little confusing that the error appears as "Task 1 is no longer passing"... Made me think it was broken on step one.
1codechic
9,399 PointsYou are welcome M F. Yeah it can be a little confusing, it took me a while to figure it out when I first ran into problems like that before. Best of luck on your jouney! Happy coding!
1 Answer
1codechic
9,399 PointsHi MF,
Task 1 stops working because you didn't update the variable of wordBrown to extract the substring of "brown" correctly. Remember the substring method returns the characters in a string "beginning at the specified location" through the "specified number of characters". So in this challenge you want the variable of wordBrown to look like this:
var wordBrown = quick.substr(start, length);
final would look like:
var wordBrown = quick.substr(10, 5);
Hope that helps, Antiffia (Tiffany)
1codechic
9,399 Points1codechic
9,399 PointsHi MF,
Task 1 stops working because you didn't update the variable of wordBrown to extract the substring of "brown" correctly. Remember the substring method returns the characters in a string "beginning at the specified location" through the "specified number of characters". So in this challenge you want the variable of wordBrown to look like this:
var wordBrown = quick.substr(start, length);
final would look like:
var wordBrown = quick.substr(10, 5);
Hope that helps, Antiffia (Tiffany)