-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
160 additions
and
49 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pletcher@pletcher.local.331 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
# Created by https://www.gitignore.io/api/node | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
.results.json |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,39 @@ | ||
'use strict'; | ||
function theBeatlesPlay(musicians, instruments) { | ||
const arr = [] | ||
|
||
for (let i = 0, l = musicians.length; i < l; i++) { | ||
arr.push(`${musicians[i]} plays ${instruments[i]}`) | ||
} | ||
|
||
return arr | ||
} | ||
|
||
function johnLennonFacts() { | ||
const facts = [ | ||
"He was the last Beatle to learn to drive", | ||
"He was never a vegetarian", | ||
"He was a choir boy and boy scout", | ||
"He hated the sound of his own voice" | ||
] | ||
|
||
const shoutedFacts = [] | ||
|
||
let i = 0 | ||
while (i < facts.length) { | ||
shoutedFacts.push(`${facts[i]}!!!`) | ||
i++ | ||
} | ||
|
||
return shoutedFacts | ||
} | ||
|
||
function iLoveTheBeatles(n) { | ||
const arr = [] | ||
|
||
do { | ||
arr.push('I love the Beatles!') | ||
n++ | ||
} while (n < 15) | ||
|
||
return arr | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "js-beatles-loops-lab", | ||
"version": "0.1.0", | ||
"description": "JavaScript for Beatles Fans", | ||
"main": "beatles.js", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "mocha -R mocha-multi --reporter-options nyan=-,json=.results.json" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/learn-co-curriculum/js-beatles-loops-lab.git" | ||
}, | ||
"keywords": [ | ||
"javascript", | ||
"beatles", | ||
"flatiron", | ||
"loops" | ||
], | ||
"author": "@vicfriedman", | ||
"license": "SEE LICENSE IN LICENSE.md", | ||
"bugs": { | ||
"url": "https://github.com/learn-co-curriculum/js-beatles-loops-lab/issues" | ||
}, | ||
"homepage": "https://github.com/learn-co-curriculum/js-beatles-loops-lab#readme", | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"jsdom": "^9.0.0", | ||
"mocha": "^2.4.5", | ||
"mocha-jsdom": "^1.1.0", | ||
"mocha-multi": "^0.9.0" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*global beforeEach, describe, it */ | ||
|
||
const expect = require('chai').expect | ||
const fs = require('fs') | ||
const jsdom = require('mocha-jsdom') | ||
const path = require('path') | ||
|
||
describe('theBeatlesPlay', () => { | ||
jsdom({ | ||
src: fs.readFileSync(path.resolve(__dirname, '..', 'beatles.js'), 'utf-8') | ||
}) | ||
|
||
it("returns an array of strings containing what instruments each instrument plays", () => { | ||
const musicians = ["John Lennon", "Paul McCartney", "George Harrison", "Ringo Starr"]; | ||
const instruments = ["Guitar", "Bass Guitar", "Lead Guitar", "Drums"]; | ||
|
||
expect(theBeatlesPlay(musicians, instruments)).to.eql(["John Lennon plays Guitar", "Paul McCartney plays Bass Guitar", "George Harrison plays Lead Guitar", "Ringo Starr plays Drums"]); | ||
}); | ||
|
||
describe('johnLennonFacts', () => { | ||
it("returns an array of strings with exclamation points", () => { | ||
expect(johnLennonFacts()).to.eql(["He was the last Beatle to learn to drive!!!", "He was never a vegetarian!!!", "He was a choir boy and boy scout!!!", "He hated the sound of his own voice!!!"]); | ||
}); | ||
}); | ||
|
||
describe('iLoveTheBeatles', () => { | ||
it("returns an array of 'I love the Beatles!' 8 times when passed the parameter 7 ", () => { | ||
expect(iLoveTheBeatles(7)).to.eql(["I love the Beatles!", "I love the Beatles!", "I love the Beatles!", "I love the Beatles!", "I love the Beatles!", "I love the Beatles!", "I love the Beatles!", "I love the Beatles!"]); | ||
}); | ||
|
||
it("returns an array of 'I love the Beatles!' once when passed the parameter 17", () => { | ||
expect(iLoveTheBeatles(17)).to.eql(["I love the Beatles!"]); | ||
}); | ||
}); | ||
}); |