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 express = require('express'); | |
const mongoose = require('mongoose'); | |
const bodyParser = require('body-parser'); | |
//Instantiate express app | |
const app = express(); | |
//connect to mongoose | |
mongoose.Promise = global.Promise; | |
mongoose |
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 express = require('express'); | |
const mongoose = require('mongoose'); | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
//connect to mongoose | |
mongoose.Promise = global.Promise; | |
mongoose | |
.connect( |
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 express = require('express'); | |
const mongoose = require('mongoose'); | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
//Home page | |
app.get('/', (req, res) => { | |
res.send('about'); | |
}); |
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
var numSquares = 6; | |
var pickedColor; | |
var squares = document.querySelectorAll(".square"); | |
var systemMessageDisplay = document.querySelector("#default-code"); | |
var userMessageDisplay = document.querySelector("#user-code"); | |
var resetButton = document.querySelector("#reset"); | |
var modeButtons = document.querySelectorAll(".mode"); | |
var header = document.querySelector('#header'); | |
var colors = generateRandomColors(6); |
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
function randomColor(){ | |
//pick a "red" from 0 - 255 | |
var r = Math.floor(Math.random() * 256); | |
//pick a "green" from 0 -255 | |
var g = Math.floor(Math.random() * 256); | |
//pick a "blue" from 0 -255 | |
var b = Math.floor(Math.random() * 256); | |
return "rgb(" + r + ", " + g + ", " + b + ")"; | |
} |
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
function generateRandomColor(num) { | |
//make an array | |
var arr = []; | |
// run the randomColor function num times | |
for (i=0; i < num ; i++) { | |
arr.push(randomColors()); | |
} | |
// return an array | |
return arr; | |
} |
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
// Reset Game... | |
resetButton.addEventListener('click', function(){ | |
colors = generateRandomColors(6); | |
pickedColor = pickColor(); | |
for(i=0; i<=squares.length; i++) { | |
squares[i].style.backgroundColor = colors[i]; | |
} | |
}) |
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
var numSquares = 6; | |
var pickedColor; | |
var squares = document.querySelectorAll(".square"); | |
var systemMessageDisplay = document.querySelector("#default-code"); | |
var userMessageDisplay = document.querySelector("#user-code"); | |
var resetButton = document.querySelector("#reset"); | |
var modeButtons = document.querySelectorAll(".mode"); | |
var header = document.querySelector('#header'); | |
var colors = generateRandomColors(6); |
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
var numSquares = 6; | |
var pickedColor; | |
var squares = document.querySelectorAll(".square"); | |
var messageDisplay = document.querySelector("#message"); | |
var resetButton = document.querySelector("#reset"); | |
var modeButtons = document.querySelectorAll(".mode"); | |
var colors = [ | |
"rgb(255, 0, 0)", | |
"rgb(0, 255, 0)", |
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
body { | |
background-color: #232323; | |
margin: 0; | |
font-family: "Montserrat", "Avenir"; | |
} | |
h1 { | |
text-align: center; | |
line-height: 1.1; | |
font-weight: normal; |