pub fn pop(this: &Value, _: &[Value], _: &mut Interpreter) -> ResultValue {
    let curr_length: i32 =
        from_value(this.get_field_slice("length")).expect("Could not convert argument to i32");
    if curr_length < 1 {
        return Err(to_value(
            "Cannot pop() on an array with zero length".to_string(),
        ));
    }
    let pop_index = curr_length.wrapping_sub(1);
    let pop_value: Value = this.get_field(&pop_index.to_string());
    this.remove_prop(&pop_index.to_string());
    this.set_field_slice("length", to_value(pop_index));
    Ok(pop_value)
}
/// Array.prototype.pop ( )
///
/// The last element of the array is removed from the array and returned.
/// <https://tc39.es/ecma262/#sec-array.prototype.pop>
Array.prototype.pop ( )
The last element of the array is removed from the array and returned.
Array . prototype . pop ( ) The last element of the array is removed from the array and returned .
pub fn pop(this: &Value, _: &[Value], _: &mut Interpreter) -> ResultValue {
    let curr_length: i32 =
        from_value(this.get_field_slice("length")).expect("Could not convert argument to i32");
    if curr_length < 1 {
        return Err(to_value(
            "Cannot pop() on an array with zero length".to_string(),
        ));
    }
    let pop_index = curr_length.wrapping_sub(1);
    let pop_value: Value = this.get_field(&pop_index.to_string());
    this.remove_prop(&pop_index.to_string());
    this.set_field_slice("length", to_value(pop_index));
    Ok(pop_value)
}
pub fn pop ( this : & Value , _ : & [ Value ] , _ : & mut Interpreter ) -> ResultValue { let curr_length : i32 = from_value ( this . get_field_slice ( " " ) ) . expect ( " " ) ; if curr_length < 1 { return Err ( to_value ( " " . to_string ( ) , ) ) ; } let pop_index = curr_length . wrapping_sub ( 1 ) ; let pop_value : Value = this . get_field ( & pop_index . to_string ( ) ) ; this . remove_prop ( & pop_index . to_string ( ) ) ; this . set_field_slice ( " " , to_value ( pop_index ) ) ; Ok ( pop_value ) }
Array.prototype.pop ( )
The last element of the array is removed from the array and returned.
Array . prototype . pop ( ) The last element of the array is removed from the array and returned .
this
&mut Interpreter
this
&mut Interpreter