<<<<<<< HEAD Code Wars - Brett Crafton

Area or Perimeter

Question

You are given the length and width of a 4-sided polygon. The polygon can either be a rectangle or a square. If it is a square, return its area. If it is a rectangle, return its perimeter. Note: for the purposes of this kata you will assume that it is a square if its length and width are equal, otherwise it is a rectangle.

area_or_perimeter(6, 10) --> 32 area_or_perimeter(3, 3) --> 9

Solution by -

My Solution


	const areaOrPerimeter = function(l , w) {
		return l == w ? l*w : 2*l + 2*w
		};
				

Try it yourself - CodeWars

======= Code Wars - Brett Crafton

Area or Perimeter

Question

You are given the length and width of a 4-sided polygon. The polygon can either be a rectangle or a square. If it is a square, return its area. If it is a rectangle, return its perimeter. Note: for the purposes of this kata you will assume that it is a square if its length and width are equal, otherwise it is a rectangle.

area_or_perimeter(6, 10) --> 32 area_or_perimeter(3, 3) --> 9

Solution by -

My Solution


	const areaOrPerimeter = function(l , w) {
		return l == w ? l*w : 2*l + 2*w
		};
				

Try it yourself - CodeWars

>>>>>>> 0e614172debaa009c8d31330edbeb3b765b59c39