Day1 Arithmetic Operators

Objective

In this challenge, we practice using arithmetic operators. Check out the attached tutorial for resources.


Task

Complete the following functions in the editor below:

  1. getArea(length, width): Calculate and return the area of a rectangle having sides length and width.
  2. getPerimeter(length, width): Calculate and return the perimeter of a rectangle having sides length and width.

The values returned by these functions are printed to stdout by locked stub code in the editor.


Day0 Data Types

Objective

Today, we’re discussing data types. Check out the attached tutorial for more details.


Task

Variables named firstInteger, firstDecimal, and firstString are declared for you in the editor below. You must use the + operator to perform the following sequence of operations:

  1. Convert secondInteger to an integer (Number type), then sum it with firstInteger and print the result on a new line using console.log.
  2. Convert secondDecimal to a floating-point number (Number type), then sum it with firstDecimal and print the result on a new line using console.log.
  3. Print the concatenation of firstString and secondString on a new line using console.log. Note that must be printed first.

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×