Skip to content
This repository was archived by the owner on Oct 26, 2020. It is now read-only.

Commit 2f210fe

Browse files
committed
still working
1 parent d57687a commit 2f210fe

4 files changed

Lines changed: 26 additions & 21 deletions

File tree

‎week-1/0-freecodecamp/week2ex.js‎

Whitespace-only changes.

‎week-1/2-mandatory/4-tax.js‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
function calculateSalesTax(productPrice) {
9-
10-
return productPrice*20/100+productPrice ;
9+
saleTax= 20/100;
10+
return productPrice*saleTax+productPrice ;
1111

1212
}
1313

@@ -25,14 +25,23 @@ console.log(calculateSalesTax(15));
2525
wrote a function for this!)
2626
*/
2727

28-
function addTaxAndFormatCurrency() {}
2928

29+
function addTaxAndFormatCurrency(productPrice) {
30+
31+
saleTax= 20/100;
32+
currency= "£" ;
33+
34+
35+
salePrice= productPrice* saleTax+ productPrice;
36+
return currency + salePrice.toFixed(2) ;
37+
38+
}
39+
40+
3041

31-
function formatCurrency() {
3242

33-
}
3443

35-
/* ======= TESTS - DO NOT MODIFY =====
44+
/* ======= TESTS - DO NOT MODIFY =====
3645
There are some Tests in this file that will help you work out if your code is working.
3746
To run these tests type `node 4-tax.js` into your terminal
3847
*/

‎week-2/2-mandatory/1-fix-functions.js‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,12 @@ function first5() {
5959
console.log(first5());
6060

6161

62-
function get3rdIndex(arr) {
62+
function get3rdIndex(array) {
6363

64-
let element= [11, 37, 62, 18, 19, 3, 30];
65-
66-
67-
return element;
64+
return array[3];
6865
}
69-
70-
71-
66+
console.log(get3rdIndex(["fruit", "banana", "apple", "strawberry", "raspberry"]));
67+
console.log(get3rdIndex([11, 37, 62, 18, 19, 3, 30]));
7268

7369
/* ======= TESTS - DO NOT MODIFY ===== */
7470

‎week-2/2-mandatory/2-function-creation.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ Write a function that:
44
- removes any spaces in the beginning or end of the strings
55
- removes any forward slashes (/) in the strings
66
- makes the string all lowercase
7-
*//*
7+
*/
8+
89
function tidyUpString(strArr) {
910
let tidU =["/Daniel ", "irina ", " Gordon", "ashleigh "];
1011

1112
return ["daniel", "irina", "gordon","ashleigh"]
1213

1314
}
1415

15-
*/
16+
1617

1718
/*
1819
Complete the function to check if the variable `num` satisfies the following requirements:
@@ -40,8 +41,9 @@ Write a function that returns a copy of the given array arr, but with the elemen
4041
The function must NOT change the original array, arr.
4142
*/
4243

43-
//function remove(arr, index) {
44-
//return; // complete this statement}
44+
function remove(arr, index) {
45+
return; // complete this statement
46+
}
4547

4648

4749
/*
@@ -52,7 +54,7 @@ Write a function that:
5254
- numbers greater 100 must be replaced with 100
5355
*/
5456

55-
//function formatPercentage(arr) {}
57+
function formatPercentage(arr) {}
5658

5759

5860

@@ -81,7 +83,6 @@ function test(test_name, actual, expected) {
8183

8284
/* ======= TESTS - DO NOT MODIFY ===== */
8385

84-
8586
function arraysEqual(a, b) {
8687
if (a === b) return true;
8788
if (a == null || b == null) return false;
@@ -142,4 +143,3 @@ test(
142143
]
143144
);
144145

145-

0 commit comments

Comments
 (0)