Message from JavaScript discussions
August 2017
— Is this a good way to make something work in both node and browser?
if (typeof module === "undefined") {
var module = { exports: null };
}
var myNamespace = module.exports = (function () {
...
(function (global) {
// Module code
global.myThingy = ...
})(typeof module !== undefined
? module.exports
: window)
— Oh hey haha, thank you
— I wound up doing something similar
— Hey i'm new here needed some help with thing
— So i have this datastructure
var list = { value: 0,
rest: { value: 1,
rest: null
}
};
— And i want to add new elements at end of this list
— Within rest?
— The innermost one?
— Yes within innermost rest
— I'm able to do that using mutability of list object
— But i was wondering whether there is a way to do the same if list was an immutable datastructure