diff --git a/my-script.js b/my-script.js index 5ac970c..54a29d4 100644 --- a/my-script.js +++ b/my-script.js @@ -8,6 +8,9 @@ * For an example, you get the first for free! */ +const greeting = (Carni) => { + return `Hello, ${Carni}!`; +} /** * Write a function called `greeting` that returns the string `Hello, !` @@ -21,46 +24,80 @@ const greeting = (name) => { /** * Write a function called `add` that returns the sum of two numbers */ +const add = function(x,y) { + return x + y; +}; /** * Write a function called `subtract` that returns the difference between two numbers */ +const subtract = function(x,y) { + return x - y; +}; /** * Write a function called `min` that returns the smaller of two numbers */ - - +const min = function(x,y) { + return Math.min(x,y); +}; /** * Write a function called `max` that returns the larger of two numbers */ - +const max = function(x,y) { + return Math.max(x,y); +}; /** * Write a function called `isEven` that takes a single value and * returns `true` if it is even and `false` if it is odd */ + const isEven = function(x) { + return x % 2 == 0; + }; +/** +*WHY IS THIS SO HARD?!?!?!? +*/ /** * Write a function called `isOdd` that takes a single value and * returns `false` if it is even and `true` if it is odd */ - +const isOdd = function(y) { + return x % 2 == 1; /** * Write a function called `factorial` that takes a single integer and * returns the product of the integer and all the integers below it */ +/* +*FORGET IT! I DID THE REST! IF I KEEP TRYING TO FIGURE +*THIS OUT, I'LL BE SPEAKING IN NUMBERS, LETTERS, AND +*SPECIAL CHARACTERS BY MORNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +*IRL BASH COMMAND!!! I'M OUT!!! + */ /** * Write a function called `oddFactorial` that takes a single integer and * returns the product of the integer and all the integers below it, but * only if they are odd. If the starting number is even, don't include it. */ - +var size = 8; + +var board = ""; + +for (var y = 0; y < size; y++) { + for (var x = 0; x < size; x++) { + if ((x + y) % 2 == 0) + board += " "; + else + board += "#"; + } + board += "\n"; +} /** * Write a function that solves the Chessboard exercise from chapter two,