-
Notifications
You must be signed in to change notification settings - Fork 0
Class Utils
class Utils
Used to simplify work.
Method | Description |
---|---|
getRandomElementFromArray(arr) | Gives random element from any array. |
getRandomNumber(min, max) | Gives random integer in range. |
RgbToHex(r, g, b) | Converts RGB to HEX color with hash at the start. |
isInRange(a, min, max) | Checks if the number a is in range. |
createImage(imagePath) | Creates new image element. |
Gives random element from any array.
Parameters:
*[]
arr - The array
Returns:
*
The random array element
Gives random integer in range.
Parameters:
number
min - The range minimum
number
max - The range maximum
Returns:
number
The random integer in range.
Converts RGB to HEX color with hash at the start.
Parameters:
number
r - The red channel
number
g - The green channel
number
b - The blue channel
Returns:
string
#RRGGBB
Checks if the number a
is in range.
Parameters:
number
a - The number to check
number
min - The range minimum
number
max - The range maximum
Returns:
boolean
is the number to check in range?
Creates new image element.
Parameters:
string
imagePath - The image source
Returns:
HTMLImageElement
The image element.