Skip to content

Instantly share code, notes, and snippets.

@jfrites
jfrites / ProblemSet.js
Last active January 3, 2020 16:35
Problem Set
//Do You Play The Theremin
let doYouPlayTheTheremin = (name) => {
if (name.charAt(0) ===
's' || name.charAt(0) ===
'S') {
return true;
} else;
return false;
};
@jfrites
jfrites / 05Functions.js
Last active January 3, 2020 00:42
05-Functions
//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") => {
@jfrites
jfrites / functions.js
Created January 3, 2020 00:24
Functions Examples and Samples
//instructions for function will only run when you invoke it
function imAFunction () {
console.log("hello world");
}
//invoking a function
imAFunction();
//-----------------
@jfrites
jfrites / ifElse.js
Created January 3, 2020 00:23
If Else Examples
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;
@jfrites
jfrites / javascript.js
Created January 3, 2020 00:22
Basic JavaScript Examples from FS
//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);
@jfrites
jfrites / switchStatement.js
Last active January 3, 2020 00:18
Switch Statement JS Example
const taxCalulator = (amount, state) => {
switch (state) {
case "NY":
return amount * 1.04;
case "NJ":
return amount * 1.0625;
default:
return amount;
}
};
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
{
"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"