return “Change Me”;
// Only change code above this line
// Change this value to test
console.log(testSize(19));
function testSize(num) {
// Only change code below this line
if (num < 5) {
return "Tiny";
} else if (num < 10) {
return "Small";
} else if (num < 15) {
return "Medium";
} else if (num < 20) {
return "Large";
} else {
return "Huge";
}
}
return "Change Me";
// Only change code above this line
// Change this value to test
console.log(testSize(19));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36.
It’s important to pay attention to the errors that the console is providing you. When I paste your code in the error is:
SyntaxError: unknown: ‘return’ outside of function
This means that you are returning something outside of your function which shouldn’t be the case. Make sure you do not alter the base code and follow the instructions within the comments.
function testSize(num) {
// Only change code below this line
return "Change Me";
// Only change code above this line
}
function testSize(num) {
// Only change code below this line
if (num < 5) {
return "Tiny";
} else if (num < 10) {
return "Small";
} else if (num < 15) {
return "Medium";
} else if (num < 20) {
return "Large";
} else {
return "Huge";
}
return "Change me";
// Only change code above this line
// Change this value to test
console.log(testSize(19));
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.
You changed code below the line that says “Only change code above this line”.
Specifically, you deleted a }. This means that your function has no closing brace and your code cannot run.
I find it unlikely that the video told you to delete anything below that line. I told you what you deleted and why it causes a problem. You can fix it manually, or you can reset the code and write your solution again.
Wasn’t the last case supposed to be" else if (num >= 20 ) return “huge”? And then the last return right before the last curly brace :
else {return “change me”}
you don’t need to keep the return "Change me" line - it is saying to be change, you can delete that
you need to keep the curly bracket that was below the Change code only above this line
count your brackets, there should be an equal number of opening and closing ones