Hey Camilo, instead of using delete, you could set the pointer to null. #perfTip :p
Sorry I'm lost, could you please write the example code?
On delete operation you can use got[character] = null; instead of delete got[character];. Take a look on jsperf.com/delete-vs-undefined-vs-...
delete
got[character] = null;
delete got[character];
Not works as CRU*D* operation, because the 'character' is not removed, just the values are replaced by null.
null
I tested changing on Delete script. When run the script show: Tyrion: null.
Tyrion: null
Can be used if you want leave the character, but remove his data.
Nice link BTW. I did not know about the performance comparison between null and delete
Some comments have been hidden by the post's author - find out more
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey Camilo, instead of using delete, you could set the pointer to null. #perfTip :p
Sorry I'm lost, could you please write the example code?
On
delete
operation you can usegot[character] = null;
instead ofdelete got[character];
. Take a look on jsperf.com/delete-vs-undefined-vs-...Not works as CRU*D* operation, because the 'character' is not removed, just the values are replaced by
null
.I tested changing on Delete script. When run the script show:
Tyrion: null
.Can be used if you want leave the character, but remove his data.
Nice link BTW. I did not know about the performance comparison between
null
anddelete