coffeescript-cookbook/coffeescript-cookbook.github.io

Cloning does not take effect when type of obj in Date or RegExp

jacobbubu opened this issue · 2 comments

http://coffeescriptcookbook.com/chapters/classes_and_objects/cloning

v1 = new Date('1982-2-2')
v2 = clone v1
console.dir v1 + ' ' + v2

Output:
'Tue Feb 02 1982 00:00:00 GMT+0800 (CST) Wed Apr 11 2012 17:56:14 GMT+0800 (CST)'

You are completely right about this.

Do you think we should keep the recipe or should we remove it?

If you want, then please add a pull request that clarifies what the code actually does. (deep copy vs. clone) :)

I’m closing this issue for now, you are welcome to open it again if #41 didn’t fix it :)