Can a function's return value be an lvalue in JavaScript?
问题 Microsoft allows to set environment variables in JScript with the following syntax: var sh = WScript.CreateObject("Wscript.Shell"); var env = sh.Environment("PROCESS"); env("TEST") = "testvalue"; I wonder about the third line - and with me JSLint, which calls this line a "Bad Assigment". But it works! Is it ECMAscript standard compatible to have a function's return value as an lvalue (like here)? If yes: How would one write such a function? 回答1: Yes, the standard permits functions to returns