Skip to content

Instantly share code, notes, and snippets.

@liseferguson
Created March 10, 2018 01:12
Show Gist options
  • Save liseferguson/66c17f03b82e1e6502940445840ec471 to your computer and use it in GitHub Desktop.
Save liseferguson/66c17f03b82e1e6502940445840ec471 to your computer and use it in GitHub Desktop.
Area function - Computes area of rectangle
function computeArea(width, height) {
return width* height;
}
/* From here down, you are not expected to
understand.... for now :)
Nothing to see here!
*/
// tests
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