You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
613 B
JavaScript
19 lines
613 B
JavaScript
5 years ago
|
'use strict';
|
||
|
var $export = require('./_export');
|
||
|
var $fails = require('./_fails');
|
||
|
var aNumberValue = require('./_a-number-value');
|
||
|
var $toPrecision = 1.0.toPrecision;
|
||
|
|
||
|
$export($export.P + $export.F * ($fails(function () {
|
||
|
// IE7-
|
||
|
return $toPrecision.call(1, undefined) !== '1';
|
||
|
}) || !$fails(function () {
|
||
|
// V8 ~ Android 4.3-
|
||
|
$toPrecision.call({});
|
||
|
})), 'Number', {
|
||
|
toPrecision: function toPrecision(precision) {
|
||
|
var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!');
|
||
|
return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision);
|
||
|
}
|
||
|
});
|