TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

JavaScript Calculator

Page: 1 Reply
May 10th 2004#150106 Report
Member since: May 7th 2004
Posts: 7
Hi Guys,

I made this calculator using JavaScript and Photoshop 5.5, your comments and suggestions for improvements are greatly apperciated

Thanks

Sagun
Reply with Quote Reply
May 10th 2004#150107 Report
Member since: Mar 20th 2001
Posts: 3367
Coding wise, (just a thought)would it be a better way if the Operator functions take in 2 parameters and return a value? Also, maybe you might wanna add accumulated operations.

Eg, 5+5+5+5 .. where the total value displayed is used for the next calculation?
Reply with Quote Reply
May 10th 2004#150110 Report
Member since: May 7th 2004
Posts: 7
Hi sidez,

I didn't understand what you meant by the Operation function??? I don't have an Operation function in my code, i do have an operation variable, or did you meant Equals function?

Sagun.
Reply with Quote Reply
May 10th 2004#150113 Report
Member since: Mar 20th 2001
Posts: 3367
Sorry bout the confusion. Operator functions as in the Addtion/Subtraction/Multiply/Division/etc.
Reply with Quote Reply
May 10th 2004#150119 Report
Member since: May 7th 2004
Posts: 7
There are several reasons I didn't do it that way:
1) I had already created the two variables holding the numbers are gobal variables
2) The equals to button calls the Equals to functions and that what figures out which operand did the user press
3) (I think) that way its much easier to code rather than coding in differen fucntions and again calling it through Equals to functions.

Maybe I am wrong, may be I didn't understand your suggestion properly. Anyways its not meant to offend you, I really like you showing interest in reading my codes, I thank you for that.

Sagun.
Reply with Quote Reply
May 10th 2004#150142 Report
Member since: Mar 20th 2001
Posts: 3367
Just a though really. Cause if i were to do it, it'll be modular, so in some way code is reusable if you were to expand and add more functions to a simple calculator that was started ;)
Reply with Quote Reply
May 10th 2004#150155 Report
Member since: May 7th 2004
Posts: 7
I started this project with simple calculator in mind, therefore I didn't think of making my code compact and reuseable, and on top of that I don't think I'll be updating the code now. It was just for fun
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum