Skip to content

Commit

Permalink
add doc about using spread on "Array-like" things, phetsims/perennial…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Mar 3, 2020
1 parent 9d5b005 commit ab235e7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/wilder/model/WilderModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class WilderModel {

hardAssert( rest( 1, 2, 3, 4, 5, 6 ) === 7 );

// Spread operator
// Spread operator - NOTE Do not use this on "array like" things, it doesn't get transpiled correctly. Instead use
// `Array.from`. See https://github.com/phetsims/perennial/issues/153
const constArray = [ 1, 2, 3 ];
hardAssert( [ ...constArray, 4, 5, ...constArray ].length === 8 );
hardAssert( rest( 4, ...constArray ) === 7 );
Expand Down

0 comments on commit ab235e7

Please sign in to comment.