power method

num power(
  1. num exponent
)

Raises the current number to the power of exponent.

This method calculates the current number raised to the specified exponent. The result is converted to an integer.

Parameters:

  • exponent: The exponent to raise the current number to.

Returns: The current number raised to the power of exponent, converted to an integer.

Example:

print(2.power(3)); // Outputs: 8 (2^3)

Implementation

num power(num exponent) => pow(this, exponent).toInt();