Foundations

Return Values

Return Values

return sends a value back to the place where the function was called. Logging shows a value, but returning gives the rest of the program a value it can use.

Your task: Declare getCourseLevel so it returns "foundation". Store the returned value in courseLevel, then log it.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Return Values

return sends a value back to the place where the function was called. Logging shows a value, but returning gives the rest of the program a value it can use.

Your task: Declare getCourseLevel so it returns "foundation". Store the returned value in courseLevel, then log it.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Console

Run code to see output.