You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while trying to return a Symbol (like following script) from execute sync command, I realized the Symbol will be serialized into an empty object.
returnSymbol(1);
Based on the internal JSON clone algorithm, if the value is a Symbol, it will run to the last Otherwise branch. Thus, IIUC, it will get into clone an object and end up returning an empty object.
However, JSON.stringify(Symbol(1)) returns undefined. It's not serialized into an empty object. So, I wonder if we should serialize Symbol values to null (like what undefined is serialized) as well?
The text was updated successfully, but these errors were encountered:
while trying to return a Symbol (like following script) from execute sync command, I realized the Symbol will be serialized into an empty object.
Based on the
internal JSON clone algorithm
, if the value is a Symbol, it will run to the lastOtherwise
branch. Thus, IIUC, it will get intoclone an object
and end up returning an empty object.However,
JSON.stringify(Symbol(1))
returnsundefined
. It's not serialized into an empty object. So, I wonder if we should serialize Symbol values tonull
(like whatundefined
is serialized) as well?The text was updated successfully, but these errors were encountered: