Create an array filled with
truevalues and having a specified length.
var trues = require( '@stdlib/array/trues' );Creates an array filled with true values and having a specified length.
var arr = trues( 2 );
// returns <BooleanArray>[ true, true ]The function recognizes the following data types:
bool: boolean values.generic: generic JavaScript values.
By default, the output array data type is 'bool'. To specify an alternative data type, provide a dtype argument.
var arr = trues( 2, 'generic' );
// returns [ true, true ]var logEach = require( '@stdlib/console/log-each' );
var trues = require( '@stdlib/array/trues' );
// Create a filled array:
var x = trues( 10 );
logEach( '%s', x );