Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Feedback #1

Open
wants to merge 2 commits into
base: feedback
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions student/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
// return the string
function returnTheString (string) {
// your code here
return(string);
}

// Exercise 1
// Given a 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};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solution is correct. Just a very minor comment: normal variable names should always start with a small letter In JavaScript. Variable names with a capital letter are usually reserved for special cases like classes or in React also react components.
So this line is absolutely correct(!), this is just a common convention :)

return NewObject
// your code here
}

Expand All @@ -24,27 +29,33 @@ function shallowCopyObject (object) {
// return a shallow copy of the array
function shallowCopyArray (array) {
// your code here
const NewArray=[...array];
return NewArray;
}

// Exercise 4
// Given two objects,
// 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
// Given two arrays,
// 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,
shallowCopyObject,
shallowCopyArray,
mergeTwoObjects,
combineTwoArrays,
};
};*/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your solutions are correct but the test is failing because you commented out this line and line 53 :) if you activate them again, the test will pass as well :)