Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

copy

Copy the elements of an array-like object to a new "generic" array.

Usage

var copy = require( '@stdlib/array/base/copy' );

copy( x )

Copies the elements of an array-like object to a new "generic" array.

var x = [ 1, 2, 3 ];

var out = copy( x );
// returns [ 1, 2, 3 ]

var bool = ( out === x );
// returns false

Examples

var Complex64Array = require( '@stdlib/array/complex64' );
var copy = require( '@stdlib/array/base/copy' );

// Create a complex number array:
var arr = new Complex64Array( 10 );

// Copy elements to a generic array:
var out = copy( arr );

// Retrieve the first element:
var z = out[ 0 ];
// returns <Complex64>[ 0.0, 0.0 ]

console.log( '%s', z.toString() );
// => '0 + 0i'