Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
697 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var DESCRIPTORS = require('../internals/descriptors');
|
---|
3 | var addToUnscopables = require('../internals/add-to-unscopables');
|
---|
4 | var toObject = require('../internals/to-object');
|
---|
5 | var toLength = require('../internals/to-length');
|
---|
6 | var defineProperty = require('../internals/object-define-property').f;
|
---|
7 |
|
---|
8 | // `Array.prototype.lastIndex` getter
|
---|
9 | // https://github.com/keithamus/proposal-array-last
|
---|
10 | if (DESCRIPTORS && !('lastIndex' in [])) {
|
---|
11 | defineProperty(Array.prototype, 'lastIndex', {
|
---|
12 | configurable: true,
|
---|
13 | get: function lastIndex() {
|
---|
14 | var O = toObject(this);
|
---|
15 | var len = toLength(O.length);
|
---|
16 | return len == 0 ? 0 : len - 1;
|
---|
17 | }
|
---|
18 | });
|
---|
19 |
|
---|
20 | addToUnscopables('lastIndex');
|
---|
21 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.