January 2018
Intermediate to advanced
332 pages
7h 36m
English
To use the Stack class created previously, you would have to make a minor change to allow the stack to be used based on the environment in which you are planning to use it. Making this change generic is fairly straightforward; that way, you do not need to worry about multiple environments to support and can avoid repetitive code in each application:
// AMDif (typeof define === 'function' && define.amd) { define(function () { return Stack; });// NodeJS/CommonJS} else if (typeof exports === 'object') { if (typeof module === 'object' && typeof module.exports === 'object') { exports = module.exports = Stack; }// Browser} else { window.Stack = Stack;}
Once we add this logic to the stack, it is multi-environment ready. For the purpose ...
Read now
Unlock full access