Compare commits

...

2 Commits

Author SHA1 Message Date
Gideon Cameron
c3c164bea7 Added some of the Math methods 2025-01-16 21:25:03 -08:00
Gideon Cameron
cd95d18c5b Included some str prototypes 2025-01-16 21:17:14 -08:00

View File

@@ -99,3 +99,22 @@ arr.reduce(callback[, initialValue]) // Apply a function against
arr.reduceRight(callback[, initialValue]) // Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
arr.some(callback[, initialValue]) // Returns true if at least one element in this array satisfies the provided testing function.
arr.values() // Returns a new Array Iterator object that contains the values for each index in the array.
// String.prototype.startsWith()
str.startsWith(searchString[, position]) // Checks if the string starts with the given characters.
str.endsWith(searchString[, length]) // Checks if the string ends with the given characters.
str.includes(searchString[, position]) // Checks if the string contains the given characters.
str.repeat(count) // Repeats the string for the specified number of times.
// Math methods
Math.max(value1, value2, ..., valueN) // Returns the largest number from the given arguments.
Math.min(value1, value2, ..., valueN) // Returns the smallest number from the given arguments.
Math.random() // Generates a random number between 0 (inclusive) and 1 (exclusive).
Math.round(x) // Rounds the number to the nearest integer.
Math.floor(x) // Rounds the number down to the nearest integer.
Math.ceil(x) // Rounds the number up to the nearest integer.
Math.pow(base, exponent) // Raises the base to the power of the exponent.
Math.sqrt(x) // Returns the square root of a number.
Math.trunc(x) // Removes the fractional part of a number, returning only the integer part.