Ready for a fun challenge? Its all about helping you ease into becoming that amazing developer that we all know you are. Well it’s simple. Help us create together a nice library of math and math related functions (based on our Developer Basics classes). Every member will win some points. If we reach our 25 useful functions we will raffle a book from our goodie bag.
Task: create a function that is inspired by the Math class (in other words recreate the Math functions or come up with other useful mathematical functions that aren’t part of the math class).
1) Every answer needs to be unique and needs to work in the real world.
2) You need to understand what you pasted in 😛 – I’ll check!
3) You can submit as many answers as you want – only rule is you can’t do it all at one time
– you must wait for one other person to submit an answer before posting a new post for it to be counted in.
What you will get:
– just for posting something correct 2 bonus points (that is if it wasn’t done already before you).
– if we get more than 25 correct answers we will raffle a free month on our site/ or a free book if you are one of us already.
To take part just replay this thread with your answer (no duplicates but you can do the same Math function if you have a unique way that wasn’t covered yet up here). Have FUN !
Functions created already:
1) deleteHigh – Finds the highest number in an array and extracts it from it and returns it to the caller (Carole +2 bonus points).
2) rotateToPoint – rotates display objects to look at random points on the screen(Adam +2 bonus points).
3) discount calculator – set a price and discount and get the product price(Ramez +2 bonus points)
4) intRandom – you set a range the function returns an integer between these values (Michael 2 Points)
5) average -input an array and get the average value. (Carole now at 4 extra points).
6) … it could be you …
Current Score Board:
Carole – 4 Points
Ramez – 2 Points
Adam – 2 Points
Michael – 2 Points
Ideas for other functions that could be created:
Math.random, Math.abs, Math.ceil, Math.floor, Math.round … and more