pub(crate) fn slice(this: &Value, args: &[Value], context: &mut Context) -> Result<Value> {
        // 1. Let O be ? ToObject(this value).
        let o = this.to_object(context)?;

        // 2. Let len be ? LengthOfArrayLike(O).
        let len = o.length_of_array_like(context)?;

        // 3. Let relativeStart be ? ToIntegerOrInfinity(start).
        // 4. If relativeStart is -∞, let k be 0.
        // 5. Else if relativeStart < 0, let k be max(len + relativeStart, 0).
        // 6. Else, let k be min(relativeStart, len).
        let mut k = Self::get_relative_start(context, args.get(0), len)?;

        // 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end).
        // 8. If relativeEnd is -∞, let final be 0.
        // 9. Else if relativeEnd < 0, let final be max(len + relativeEnd, 0).
        // 10. Else, let final be min(relativeEnd, len).
        let final_ = Self::get_relative_end(context, args.get(1), len)?;

        // 11. Let count be max(final - k, 0).
        let count = final_.saturating_sub(k);

        // 12. Let A be ? ArraySpeciesCreate(O, count).
        let a = Self::array_species_create(&o, count, context)?;

        // 13. Let n be 0.
        let mut n: u64 = 0;
        // 14. Repeat, while k < final,
        while k < final_ {
            // a. Let Pk be ! ToString(𝔽(k)).
            let pk = k;
            // b. Let kPresent be ? HasProperty(O, Pk).
            let k_present = o.has_property(pk, context)?;
            // c. If kPresent is true, then
            if k_present {
                // i. Let kValue be ? Get(O, Pk).
                let k_value = o.get(pk, context)?;
                // ii. Perform ? CreateDataPropertyOrThrow(A, ! ToString(𝔽(n)), kValue).
                a.create_data_property_or_throw(n, k_value, context)?;
            }
            // d. Set k to k + 1.
            k += 1;
            // e. Set n to n + 1.
            n += 1;
        }

        // 15. Perform ? Set(A, "length", 𝔽(n), true).
        a.set("length", n, true, context)?;

        // 16. Return A.
        Ok(a.into())
    }
/// `Array.prototype.slice( [begin[, end]] )`
///
/// The slice method takes two arguments, start and end, and returns an array containing the
/// elements of the array from element start up to, but not including, element end (or through the
/// end of the array if end is undefined). If start is negative, it is treated as length + start
/// where length is the length of the array. If end is negative, it is treated as length + end where
/// length is the length of the array.
///
/// More information:
///  - [ECMAScript reference][spec]
///  - [MDN documentation][mdn]
///
/// [spec]: https://tc39.es/ecma262/#sec-array.prototype.slice
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
`Array.prototype.slice( [begin[, end]] )`
The slice method takes two arguments, start and end, and returns an array containing the
elements of the array from element start up to, but not including, element end (or through the
end of the array if end is undefined). If start is negative, it is treated as length + start
where length is the length of the array. If end is negative, it is treated as length + end where
length is the length of the array.

More information:
[ECMAScript reference][spec]
[MDN documentation][mdn]


` Array . prototype . slice ( [ begin [ end ]] ) ` The slice method takes two arguments start and end and returns an array containing the elements of the array from element start up to but not including element end ( or through the end of the array if end is undefined ) . If start is negative it is treated as length + start where length is the length of the array . If end is negative it is treated as length + end where length is the length of the array . More information : [ ECMAScript reference ] [ spec ] [ MDN documentation ] [ mdn ]
pub(crate) fn slice(this: &Value, args: &[Value], context: &mut Context) -> Result<Value> {
        // 1. Let O be ? ToObject(this value).
        let o = this.to_object(context)?;
        // 2. Let len be ? LengthOfArrayLike(O).
        let len = o.length_of_array_like(context)?;
        // 3. Let relativeStart be ? ToIntegerOrInfinity(start).
        // 4. If relativeStart is -∞, let k be 0.
        // 5. Else if relativeStart < 0, let k be max(len + relativeStart, 0).
        // 6. Else, let k be min(relativeStart, len).
        let mut k = Self::get_relative_start(context, args.get(0), len)?;
        // 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end).
        // 8. If relativeEnd is -∞, let final be 0.
        // 9. Else if relativeEnd < 0, let final be max(len + relativeEnd, 0).
        // 10. Else, let final be min(relativeEnd, len).
        let final_ = Self::get_relative_end(context, args.get(1), len)?;
        // 11. Let count be max(final - k, 0).
        let count = final_.saturating_sub(k);
        // 12. Let A be ? ArraySpeciesCreate(O, count).
        let a = Self::array_species_create(&o, count, context)?;
        // 13. Let n be 0.
        let mut n: u64 = 0;
        // 14. Repeat, while k < final,
        while k < final_ {
            // a. Let Pk be ! ToString(𝔽(k)).
            let pk = k;
            // b. Let kPresent be ? HasProperty(O, Pk).
            let k_present = o.has_property(pk, context)?;
            // c. If kPresent is true, then
            if k_present {
                // i. Let kValue be ? Get(O, Pk).
                let k_value = o.get(pk, context)?;
                // ii. Perform ? CreateDataPropertyOrThrow(A, ! ToString(𝔽(n)), kValue).
                a.create_data_property_or_throw(n, k_value, context)?;
            }
            // d. Set k to k + 1.
            k += 1;
            // e. Set n to n + 1.
            n += 1;
        }
        // 15. Perform ? Set(A, "length", 𝔽(n), true).
        a.set("length", n, true, context)?;
        // 16. Return A.
        Ok(a.into())
    }
pub ( crate ) fn slice ( this : & Value , args : & [ Value ] , context : & mut Context ) -> Result < Value > { // 1. Let O be ? ToObject(this value). let o = this . to_object ( context ) ? ; // 2. Let len be ? LengthOfArrayLike(O). let len = o . length_of_array_like ( context ) ? ; // 3. Let relativeStart be ? ToIntegerOrInfinity(start). // 4. If relativeStart is -∞, let k be 0. // 5. Else if relativeStart < 0, let k be max(len + relativeStart, 0). // 6. Else, let k be min(relativeStart, len). let mut k = Self :: get_relative_start ( context , args . get ( 0 ) , len ) ? ; // 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). // 8. If relativeEnd is -∞, let final be 0. // 9. Else if relativeEnd < 0, let final be max(len + relativeEnd, 0). // 10. Else, let final be min(relativeEnd, len). let final_ = Self :: get_relative_end ( context , args . get ( 1 ) , len ) ? ; // 11. Let count be max(final - k, 0). let count = final_ . saturating_sub ( k ) ; // 12. Let A be ? ArraySpeciesCreate(O, count). let a = Self :: array_species_create ( & o , count , context ) ? ; // 13. Let n be 0. let mut n : u64 = 0 ; // 14. Repeat, while k < final, while k < final_ { // a. Let Pk be ! ToString(𝔽(k)). let pk = k ; // b. Let kPresent be ? HasProperty(O, Pk). let k_present = o . has_property ( pk , context ) ? ; // c. If kPresent is true, then if k_present { // i. Let kValue be ? Get(O, Pk). let k_value = o . get ( pk , context ) ? ; // ii. Perform ? CreateDataPropertyOrThrow(A, ! ToString(𝔽(n)), kValue). a . create_data_property_or_throw ( n , k_value , context ) ? ; } // d. Set k to k + 1. k += 1 ; // e. Set n to n + 1. n += 1 ; } // 15. Perform ? Set(A, "length", 𝔽(n), true). a . set ( " " , n , true , context ) ? ; // 16. Return A. Ok ( a . into ( ) ) }
`Array.prototype.slice( [begin[, end]] )`
The slice method takes two arguments, start and end, and returns an array containing the
elements of the array from element start up to, but not including, element end (or through the
end of the array if end is undefined).
` Array . prototype . slice ( [ begin [ end ]] ) ` The slice method takes two arguments start and end and returns an array containing the elements of the array from element start up to but not including element end ( or through the end of the array if end is undefined ) .
this
&Value
args
&[Value]
context
&mut Context
this
&Value
args
&[Value]
context
&mut Context