- Hands-On Data Structures and Algorithms with JavaScript
- Kashyap Mukkamala
- 152字
- 2021-06-30 19:12:07
Creating a stack
Now that we know when and why we would want to use a stack, let's move on to implementing one. As discussed in the preceding section, we will use a WeakMap() for our implementation. You can use any native data type for your implementation, but there are certain reasons why WeakMap() would be a strong contender. WeakMap() retains a weak reference to the keys that it holds. This means that once you are no longer referring to that particular key, it gets garbage-collected along with the value. However, WeakMap() come with its own downsides: keys can only be nonprimitives and are not enumerable, that is, you cannot get a list of all the keys, as they are dependent on the garbage collector. However, in our case, we are more concerned with the values that our WeakMap() holds rather than keys and their internal memory management.
- iOS Game Programming Cookbook
- ReSharper Essentials
- Building Modern Web Applications Using Angular
- 軟件測試項目實戰之性能測試篇
- 精通軟件性能測試與LoadRunner實戰(第2版)
- Python高效開發實戰:Django、Tornado、Flask、Twisted(第2版)
- R的極客理想:工具篇
- SharePoint Development with the SharePoint Framework
- .NET 3.5編程
- 數據結構與算法分析(C++語言版)
- Integrating Facebook iOS SDK with Your Application
- Creating Mobile Apps with jQuery Mobile(Second Edition)
- R數據科學實戰:工具詳解與案例分析
- 小程序從0到1:微信全棧工程師一本通
- Visual Basic 程序設計實踐教程