@@ -3,16 +3,14 @@ Write a function that:
33- Accepts an array as a parameter.
44- Returns a new array containing the first five elements of the passed array.
55*/
6- function first5 ( ) {
7- }
6+ function first5 ( ) { }
87
98/*
109Write a function that:
1110- Accepts an array as a parameter.
1211- Returns a new array containing the same elements, except sorted.
1312*/
14- function sortArray ( ) {
15- }
13+ function sortArray ( ) { }
1614
1715/*
1816NOTE: This exercise is the same as one you did last week - try to do it again using things you learnt this week.
@@ -24,17 +22,15 @@ Write a function that:
2422- Removes any forward slashes (/) in the strings.
2523- Makes the strings all lowercase.
2624*/
27- function tidyUpString ( ) {
28- }
25+ function tidyUpString ( ) { }
2926
3027/*
3128Write a function that:
3229- Takes an array and an index as input.
3330- Returns a new array containing the same elements, but without the element at the passed index.
3431*/
3532
36- function remove ( ) {
37- }
33+ function remove ( ) { }
3834
3935/*
4036Write a function that:
@@ -44,10 +40,16 @@ Write a function that:
4440- Numbers greater 100 must be replaced with 100.
4541*/
4642
47- function formatPercentage ( ) {
48- }
43+ function formatPercentage ( ) { }
4944
50- /* ======= TESTS - DO NOT MODIFY ===== */
45+ /*
46+ ===================================================
47+ ======= TESTS - DO NOT MODIFY BELOW THIS LINE =====
48+ There are some Tests in this file that will help you work out if your code is working.
49+ To run the tests for just this one file, type `npm test -- --testPathPattern 1-create-functions` into your terminal
50+ (Reminder: You must have run `npm install` one time before this will work!)
51+ ===================================================
52+ */
5153
5254test ( "first5 function works for more than five elements" , ( ) => {
5355 const numbers = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] ;
0 commit comments