Skip to content

Commit 715cef6

Browse files
author
sunjieming
committed
Initial commit
0 parents  commit 715cef6

File tree

13 files changed

+1274
-0
lines changed

13 files changed

+1274
-0
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": [ "es2015" ]
3+
}

.eslintrc.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"extends": "airbnb-base",
3+
"plugins": [
4+
"import"
5+
],
6+
"consistent-return": 0,
7+
"rules": {
8+
"no-param-reassign": 0,
9+
"max-len": 0,
10+
"no-plusplus": 0,
11+
"linebreak-style": 0,
12+
"consistent-return": 0,
13+
"no-useless-return": 0,
14+
"no-return-assign": 0,
15+
"comma-dangle": 0,
16+
"arrow-body-style": 0,
17+
"max-len": 0,
18+
"no-unused-vars": 0,
19+
"no-useless-constructor": 0,
20+
"import/no-unresolved": 0
21+
}
22+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.swp
2+
node_modules

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Basic JS

package.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "basic-javascript",
3+
"version": "1.0.0",
4+
"description": "LambdaSchool Basic JavaScript",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "eslint tests/*.js && eslint src/*.js && jest --verbose",
8+
"test:watch": "npm test -- --watch"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/SunJieMing/basic-javascript.git"
13+
},
14+
"author": "Ben Nelson",
15+
"license": "ISC",
16+
"bugs": {
17+
"url": "https://github.com/SunJieMing/basic-javascript/issues"
18+
},
19+
"homepage": "https://github.com/SunJieMing/basic-javascript#readme",
20+
"devDependencies": {
21+
"babel-jest": "^19.0.0",
22+
"eslint": "^3.17.1",
23+
"eslint-config-airbnb-base": "^11.1.3",
24+
"eslint-plugin-import": "^2.2.0",
25+
"jest": "^19.0.2",
26+
"regenerator-runtime": "^0.10.3"
27+
},
28+
"dependencies": {
29+
"babel-preset-es2015": "^6.24.0",
30+
"eslint-config-airbnb": "^14.1.0"
31+
}
32+
}

src/project-1.js

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
// Do not change any of the funcxtion names
2+
3+
const multiplyByTen = (num) => {
4+
// return num after multiplying it by ten
5+
// code here
6+
};
7+
8+
const subtractFive = (num) => {
9+
// return num after subtracting five
10+
// code here
11+
};
12+
13+
const areSameLength = (str1, str2) => {
14+
// return true if the two strings have the same length
15+
// otherwise return false
16+
// code here
17+
};
18+
19+
const areEqual = (x, y) => {
20+
// return true if x and y are the same
21+
// otherwise return false
22+
// code here
23+
};
24+
25+
const lessThanNinety = (num) => {
26+
// return true if num is less than ninety
27+
// otherwise return false
28+
// code here
29+
};
30+
31+
const greaterThanFifty = (num) => {
32+
// return true if num is greater than fifty
33+
// otherwise return false
34+
// code here
35+
};
36+
37+
const add = (x, y) => {
38+
// add x and y together and return the value
39+
// code here
40+
};
41+
42+
const subtract = (x, y) => {
43+
// subtract y from x and return the value
44+
// code here
45+
};
46+
47+
const divide = (x, y) => {
48+
// divide x by y and return the value
49+
// code here
50+
};
51+
52+
const multiply = (x, y) => {
53+
// multiply x by y and return the value
54+
// code here
55+
};
56+
57+
const getRemainder = (x, y) => {
58+
// return the remainder from dividing x by y
59+
// code here
60+
};
61+
62+
const isEven = (num) => {
63+
// return true if num is even
64+
// otherwise return false
65+
// code here
66+
};
67+
68+
const isOdd = (num) => {
69+
// return true if num is false
70+
// otherwise return false
71+
// code here
72+
};
73+
74+
const square = (num) => {
75+
// square num and return the new value
76+
// code here
77+
};
78+
79+
const cube = (num) => {
80+
// cube num and return the new value
81+
// code here
82+
};
83+
84+
const raiseToPower = (num, exponent) => {
85+
// raise num to whatever power is passed in as exponent
86+
// code here
87+
};
88+
89+
const roundNumber = (num) => {
90+
// round num and return it
91+
// code here
92+
};
93+
94+
const roundUp = (num) => {
95+
// round num up and return it
96+
// code here
97+
};
98+
99+
const addExclamationPoint = (str) => {
100+
// add an exclamation point to the end of str and return the new string
101+
// 'hello world' -> 'hello world!'
102+
// code here
103+
};
104+
105+
const combineNames = (firstName, lastName) => {
106+
// return firstName and lastName combined as one string and separated by a space.
107+
// 'Lambda', 'School' -> 'Lambda School'
108+
// code here
109+
};
110+
111+
const getGreeting = (name) => {
112+
// Take the name string and concatenate other strings onto it so it takes the following form:
113+
// 'Sam' -> 'Hello Sam!'
114+
// code here
115+
};
116+
117+
// If you can't remember these area formulas then head over to Google or look at the test code.
118+
119+
const getRectangleArea = (length, width) => {
120+
// return the area of the rectangle by using length and width
121+
// code here
122+
};
123+
124+
const getTriangleArea = (base, height) => {
125+
// return the area of the triangle by using base and height
126+
// code here
127+
};
128+
129+
const getCircleArea = (radius) => {
130+
// return the rounded area of the circle given the radius
131+
// code here
132+
};
133+
134+
const getRectangularPrismVolume = (length, width, height) => {
135+
// return the volume of the 3D rectangular prism given the length, width, and height
136+
// code here
137+
};
138+
139+
// Do not modify code below this line.
140+
// --------------------------------
141+
142+
module.exports = {
143+
multiplyByTen,
144+
subtractFive,
145+
areSameLength,
146+
areEqual,
147+
lessThanNinety,
148+
greaterThanFifty,
149+
add,
150+
subtract,
151+
divide,
152+
multiply,
153+
getRemainder,
154+
isEven,
155+
isOdd,
156+
square,
157+
cube,
158+
raiseToPower,
159+
roundNumber,
160+
roundUp,
161+
addExclamationPoint,
162+
combineNames,
163+
getGreeting,
164+
getRectangleArea,
165+
getTriangleArea,
166+
getCircleArea,
167+
getRectangularPrismVolume
168+
};

src/project-2.js

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// Do not change any of the function names
2+
3+
const getBiggest = (x, y) => {
4+
// x and y are integers. Return the larger integer
5+
// if they are the same return either one
6+
};
7+
8+
const greeting = (language) => {
9+
// return a greeting for three different languages:
10+
// language: 'German' -> 'Guten Tag!'
11+
// language: 'English' -> 'Hello!'
12+
// language: 'Spanish' -> 'Hola!'
13+
// if language is undefined return 'Hello!'
14+
};
15+
16+
const isTenOrFive = (num) => {
17+
// return true if num is 10 or 5
18+
// otherwise return false
19+
};
20+
21+
const isInRange = (num) => {
22+
// return true if num is less than 50 and greater than 20
23+
};
24+
25+
const isInteger = (num) => {
26+
// return true if num is an integer
27+
// 0.8 -> false
28+
// 1 -> true
29+
// -10 -> true
30+
// otherwise return false
31+
// hint: you can solve this using Math.floor
32+
};
33+
34+
const fizzBuzz = (num) => {
35+
// if num is divisible by 3 return 'fizz'
36+
// if num is divisible by 5 return 'buzz'
37+
// if num is divisible by 3 & 5 return 'fizzbuzz'
38+
// otherwise return num
39+
};
40+
41+
const isPrime = (num) => {
42+
// return true if num is prime.
43+
// otherwise return false
44+
// hint: a prime number is only evenly divisible by itself and 1
45+
// hint2: you can solve this using a for loop
46+
// note: 0 and 1 are NOT considered prime numbers
47+
};
48+
49+
const returnFirst = (arr) => {
50+
// return the first item from the array
51+
};
52+
53+
const returnLast = (arr) => {
54+
// return the last item of the array
55+
};
56+
57+
const getArrayLength = (arr) => {
58+
// return the length of the array
59+
};
60+
61+
const incrementByOne = (arr) => {
62+
// arr is an array of integers
63+
// increase each integer by one
64+
// return the array
65+
};
66+
67+
const addItemToArray = (arr, item) => {
68+
// add the item to the end of the array
69+
// return the array
70+
};
71+
72+
const addItemToFront = (arr, item) => {
73+
// add the item to the front of the array
74+
// return the array
75+
// hint: use the array method .unshift
76+
};
77+
78+
const wordsToSentence = (words) => {
79+
// words is an array of strings
80+
// return a string that is all of the words concatenated together
81+
// spaces need to be between each word
82+
// example: ['Hello', 'world!'] -> 'Hello world!'
83+
};
84+
85+
const contains = (arr, item) => {
86+
// check to see if item is inside of arr
87+
// return true if it is, otherwise return false
88+
};
89+
90+
const addNumbers = (numbers) => {
91+
// numbers is an array of integers.
92+
// add all of the integers and return the value
93+
};
94+
95+
const averageTestScore = (testScores) => {
96+
// testScores is an array. Iterate over testScores and compute the average.
97+
// return the average
98+
};
99+
100+
const largestNumber = (numbers) => {
101+
// numbers is an array of integers
102+
// return the largest integer
103+
};
104+
105+
// Do not modify code below this line.
106+
// --------------------------------
107+
108+
module.exports = {
109+
getBiggest,
110+
greeting,
111+
isTenOrFive,
112+
isInRange,
113+
isInteger,
114+
fizzBuzz,
115+
isPrime,
116+
returnFirst,
117+
returnLast,
118+
getArrayLength,
119+
incrementByOne,
120+
addItemToArray,
121+
addItemToFront,
122+
wordsToSentence,
123+
contains,
124+
addNumbers,
125+
averageTestScore,
126+
largestNumber
127+
};

0 commit comments

Comments
 (0)