This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Do You Play The Theremin | |
| let doYouPlayTheTheremin = (name) => { | |
| if (name.charAt(0) === | |
| 's' || name.charAt(0) === | |
| 'S') { | |
| return true; | |
| } else; | |
| return false; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //simple sum | |
| function simpleSum (a, b) { | |
| return a + b; | |
| } | |
| console.log(simpleSum(3,4)); | |
| //Default Greet | |
| //`` lets you add the implicit stuff from the parameter with te ${} this is clean | |
| const defaultGreet = (firstName, lastName = "Doe") => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //instructions for function will only run when you invoke it | |
| function imAFunction () { | |
| console.log("hello world"); | |
| } | |
| //invoking a function | |
| imAFunction(); | |
| //----------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let name = 'David'; | |
| // let name = 'Nimit'; | |
| // let name = 'Someone else'; | |
| let found; | |
| // YOUR CODE BELOW | |
| name = "Nimit" | |
| if (name === "David" || name === "Nimit") found = true; | |
| else found= false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //toUpperCase | |
| const someString = "I am excited to begin coding"; | |
| console.log(someString.toUpperCase()); | |
| //variable assignment | |
| let myFirstName = "Jason"; | |
| console.log(myFirstName); | |
| let myFavoriteNum = 62; | |
| console.log(myFavoriteNum); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const taxCalulator = (amount, state) => { | |
| switch (state) { | |
| case "NY": | |
| return amount * 1.04; | |
| case "NJ": | |
| return amount * 1.0625; | |
| default: | |
| return amount; | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class Board { | |
| constructor(numberOfRows, numberOfColumns, numberOfBombs) { | |
| this._numberOfBombs = numberOfBombs; | |
| this._numberOfTiles = numberOfRows * numberOfColumns | |
| this._playerBoard = Board.generatePlayerBoard(numberOfRows, numberOfColumns) | |
| this._bombBoard = Board.generateBombBoard(numberOfRows, numberOfColumns, numberOfBombs); | |
| } | |
| get playerBoard() { | |
| return this._playerBoard |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "minesweeper", | |
| "version": "1.0.0", | |
| "description": "Code Academy Minesweeper Lesson", | |
| "main": "minesweeper.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1", | |
| "build": "babel src - d lib" |