I found many answers about using a unique return for each function, but my question is quite tricky for me.
I really need to know if there is some reason to return a variable with the expected result or if i can just return the value, as shown below.
function bar(foo: string): string {
return foo.toUpperCase().trim()
}
function bar(foo: string): string {
let result = foo.toUpperCase().trim()
return result
}
In this specific case, which one works better? If there is no difference in performance, should i use the first or the second approach for readability and a "cleaner" code
Someone has downvoted it because its opinion based, i don't want opinions, i want to know if there is a concrete reason like performance, readability(convetions), or anything else that justify choosing between each other