In livescript
, we can use ^^
to clone an object.
For example,
consloe.log (^^{a:1})
will be compiled to
// Generated by LiveScript 1.2.0
(function(){
console.log(clone$({
a: 1
}));
function clone$(it){
function fun(){} fun.prototype = it;
return new fun;
}
}).call(this);
However, these codes work successfully in browser but not in node.js.
- In browser, it prints
fun {a: 1}
in console. - In node.js, it shows nothing.
What's the reason?