Re:How I made a game played in Notepad
by umvi on Thursday May 28, 2020 @10:55AM
(#23338006)
Does JavaScript even have a concept of stack vs heap? Seems like someone who has only used pure JS would be missing a lot of fundamental knowledge on how C works.
[ Parent
| on HN ]
Javascript sort of does
Stack - the event loop uses this for handling callback executions
Heap - memory addresses for objects. For instance if you copy over an array of objects, you are copying the pointers to those memory addresses inside the array. Also memory leaks to some extent with eventListeners especially when you use a framework like React
For the narrow purpose of the change the author made, his statement fits.
if (this || that) {dosomething();}
Is mostly identical in JS and C.
Re:How I made a game played in Notepad
by throwaway_pdp09 on Thursday May 28, 2020 @11:02AM
(#23338108)
Not really AFAIK. it's GC'd so you do as you please and it sorts it out.