Skip to content

Instantly share code, notes, and snippets.

@charstarstars
Created May 2, 2017 15:36
Show Gist options
  • Save charstarstars/91e00a65ab667ec95d7ef4b00eb242f3 to your computer and use it in GitHub Desktop.
Save charstarstars/91e00a65ab667ec95d7ef4b00eb242f3 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=91e00a65ab667ec95d7ef4b00eb242f3
<!DOCTYPE html>
<html>
<head>
<title>Calculator javascript</title>
</head>
<body>
</body>
</html>
// All the code you will need to create for this project will be completed below
// Your functions must be called the following:
// multiply, divide, subtract, add, power, square_root, logBase10, generateRandomNumber
function divide(x,y) {
//Write your code below this line
return x/y;
}
function multiply(x,y) {
}
function subtract(x,y) {
}
function add(x,y) {
}
function power(x,y) {
}
function square_root(x) {
}
function logBase10(x) {
}
function generateRandomNumber() {
}
// BONUS: write assertions to test whether your functions work!
// Here are some examples for divide(x,y), can you write more for the other functions?
//
// console.assert(divide(1,1) === 1, "1/1 should equal 1");
// console.assert(divide(1,2) === 0.5, "1/2 should equal 0.5");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment