I'm doing a simple test of Object.assign in both IO.js and Node.JS but its causing an error.
/Users/lp/.nvm/versions/io.js/v2.4.0/bin/iojs --debug-brk=59842 --nolazy mixin.js
Debugger listening on port 59842
/Users/lp/Documents/code/test/mixin.js:11
line = Object.assign(line, depth);
^
TypeError: Object.assign is not a function
Heres the code:
var line = {
x: 0,
y: 0
};
var depth = {
z: 0
};
line = Object.assign(line, depth);
I've tried Node v0.12.7 with --harmony and IO.js v2.4.0. From what I read ES6 should be supported. Is assign not supported or am I missing something?
http://kangax.github.io/compat-table/es6 is the best place to look right now and it says Object.assign is unsupported on iojs and node. It's easy enough to load a polyfill though.
The ES6 spec was only finalized last month, it isn't even close to fully implemented across platforms yet. You should plan to rely on polyfills and transpilers like Babel and Traceur if you'd like to use larger portions of ES6 on current platforms.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With