Exercise Wednesday

Goal: Practice creating an entire application with well-separated Business and User Interface logic. In this lesson we will create our back-end or Business logic, and in the following we will build out our User Interface or front-end logic.

Warm Up


  • What does the method parseInt() do? When should we use it?
  • What does the return statement do in JavaScript?

Code


Finish Calculator Business Logic

Remember when we wrote calculator functions in Calculator: Business Logic? At the time, we only created a function to add two numbers together. But now that we have more JavaScript experience under our belts, let's create methods for other calculations, too.

Revisit your old calculator project from that exercise, and add functionality to subtract, divide and multiply numbers, too.

Then, follow along with the next few lessons to add a front-end user interface to our calculator using jQuery.