Skip to content

Instantly share code, notes, and snippets.

@willwalker753
Created February 12, 2020 21:26
Show Gist options
  • Save willwalker753/1b1b2a08c4cfed06d65183aaa8e8953c to your computer and use it in GitHub Desktop.
Save willwalker753/1b1b2a08c4cfed06d65183aaa8e8953c to your computer and use it in GitHub Desktop.
Area of a Rectangle
function computeArea(width, height) {
let area = width*height;
return area
}
let width = 3;
let height = 4;
console.log(computeArea(width,height));
function testComputeArea() {
let width = 3;
let height = 4;
let expected = 12;
if (computeArea(width, height) === expected) {
console.log('SUCCESS: `computeArea` is working');
} else {
console.log('FAILURE: `computeArea` is not working');
}
}
testComputeArea();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment