From ac366d44a61d68ebbd9cf282d38bc153726348f7 Mon Sep 17 00:00:00 2001 From: Emre Karaca Date: Thu, 27 Aug 2020 13:25:16 +0200 Subject: [PATCH 1/2] Setting up GitHub Classroom Feedback From 1561366a7cc349dbb8fa2aaa2a37655af5e6b397 Mon Sep 17 00:00:00 2001 From: Reda Qero <46996571+RiedAA@users.noreply.github.com> Date: Thu, 27 Aug 2020 14:50:54 +0200 Subject: [PATCH 2/2] Solved all Exercises :) --- student/index.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/student/index.js b/student/index.js index 08f5057..37e964e 100644 --- a/student/index.js +++ b/student/index.js @@ -3,6 +3,7 @@ // return the string function returnTheString (string) { // your code here + return(string); } // Exercise 1 @@ -10,12 +11,16 @@ function returnTheString (string) { // turn it into an array of the letters in the string function splitTheString (string) { // your code here + const arrayOfLetters =[...string]; + return arrayOfLetters; } // Exercise 2 // Given an object, // return a shallow copy of the object function shallowCopyObject (object) { + const NewObject={...object}; + return NewObject // your code here } @@ -24,6 +29,8 @@ function shallowCopyObject (object) { // return a shallow copy of the array function shallowCopyArray (array) { // your code here + const NewArray=[...array]; + return NewArray; } // Exercise 4 @@ -31,6 +38,8 @@ function shallowCopyArray (array) { // turn them into one object that contains the properties of both objects function mergeTwoObjects (object1, object2) { // your code here + const NewMergedObject={...object1, ...object2}; + return NewMergedObject; } // Exercise 5 @@ -38,8 +47,10 @@ function mergeTwoObjects (object1, object2) { // turn them into one array containing all elements of both arrays function combineTwoArrays (array1, array2) { // your code here + const NewCombinedArray=[...array1,...array2]; + return NewCombinedArray; } - +/* module.exports = { returnTheString, splitTheString, @@ -47,4 +58,4 @@ module.exports = { shallowCopyArray, mergeTwoObjects, combineTwoArrays, -}; \ No newline at end of file +};*/