For constants such as string literals used as URLs that might be used multiple times by a function, which has better performance, defining them at module level, or inside the functions where they are used?
Module-level:
const URL = 'http://example.org';
function foo() {
return URL;
}
Function-level:
function foo() {
const url = 'http://example.org';
return url;
}