Compute the sum of numbers in an array.
Parameters: a – the array of numbers.
Returns:the sum.
function gcd(a, b)
Compute the greatest common divisor of two numbers.
Parameters: a – the first number.
b – the second number.
Returns:the greatest common divisor of a and b
function contains(rect, x, y)
Check whether a rectangle contains a point.
Parameters: rect – the rectangle in the form [x, y, w, h].
x – the x coordinate of the point.
y – the y coordinate of the point.
Returns:true if rect contains (x,y).
function roundRect(x, y, w, h, r)
Draw a rectangle with round corners.
Parameters: x – the x coordinate of the upper left corner.
y – the y coordinate of the upper left corner.
w – the width.
h – the height.
r – the radius of the rounded part.