I am solving a problem for school. The problem instructs me to: "create and arrow function with the following:
accepts a parameter
does not use the return keyword
returns text passed to it as lower case (with method toLowerCase() ) "
The code should be passed:
getLowerCase('MY UPPERCASE TEXT');
There are three test cases it must pass:
"getLowerCase does not use a return"
"getLowerCase returns lowercase text"
"getLowerCase is a valid arrow function"
I tried a few cases, but in my mind, they all require a return statement. I'm newer to javascript (used python previously) and I am easily confused as to how to return a value without use a return keyword explicitly.
const getLowerCase = text => {
return text.toLowerCase();
// this should make sense, but uses a return statement
};
const getLowerCase = text => {
getLowerCase: text.toLowerCase
}
// probably gobbly-goo, tried reading this posting, might have gotten lost: https://stackoverflow.com/questions/28770415/ecmascript-6-arrow-function-that-returns-an-object?noredirect=1&lq=1