MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/9mne4e/writing_lighter_faster_javascript_functions/e7g4l16/?context=3
r/javascript • u/jsloverr • Oct 09 '18
23 comments sorted by
View all comments
16
function isStooge(name) { const STOOGES = ['Larry', 'Curly', 'Moe']; return STOOGES.includes(name); };
90% sure the engine will tag that array for re-use.
In fact, wasn't the cause of that recent iOS 12 array reversal issue that mutated array literals were being re-used inappropriately?
5 u/gsnedders Oct 09 '18 In fact, wasn't the cause of that recent iOS 12 array reversal issue that mutated array literals were being re-used inappropriately?Ding-ding-ding! Yes. JSC does copy-on-write of arrays and objects consisting purely of literals.
5
Ding-ding-ding! Yes. JSC does copy-on-write of arrays and objects consisting purely of literals.
16
u/yojimbo_beta Mostly backend Oct 09 '18
90% sure the engine will tag that array for re-use.
In fact, wasn't the cause of that recent iOS 12 array reversal issue that mutated array literals were being re-used inappropriately?