The part that would violate guarantees in JavaScript is not function objects being kept alive longer, but function objects which should be distinct not being so.
function foo() {
return function() { };
}
console.log(foo() === foo()); // This must log `false` in a compliant implementation