diff --git a/exercises/001.js b/exercises/001.js index 962fdaa..fc269a3 100644 --- a/exercises/001.js +++ b/exercises/001.js @@ -2,26 +2,30 @@ Write a function 'transformFirstAndLast' that takes in an array, and returns an object with: 1) the first element of the array as the object's key, and 2) the last element of the array as that key's value. + Example input: ['Queen', 'Elizabeth', 'Of Hearts', 'Beyonce'] + Function's return value (output): { Queen : 'Beyonce' } + Do not change the input array. Assume all elements in the input array will be of type 'string'. Note that the input array may have a varying number of elements. Your code should flexibly accommodate that. + E.g. it should handle input like: ['Kevin', 'Bacon', 'Love', 'Hart', 'Costner', 'Spacey'] + Function's return value (output): { Kevin : 'Spacey' } + Starter Code -function transformFirstAndLast(array) { - // your code here -} */ function transformFirstAndLast(array) { //your code here -} \ No newline at end of file + +} diff --git a/exercises/002.js b/exercises/002.js index 71af29a..8f9a4e2 100644 --- a/exercises/002.js +++ b/exercises/002.js @@ -1,15 +1,19 @@ /* Write a function called "getAllKeys" which returns an array of all the input object's keys. + Example input: { name : 'Sam', age : 25, hasPets : true } + Function's return value (output) : ['name', 'age', 'hasPets'] + Do not use "Object.keys" to solve this prompt. Note that your function should be able to handle any object passed in it. + E.g. it should also handle an input like: { a : 'a', @@ -17,14 +21,14 @@ E.g. it should also handle an input like: hungry : true, grammyWins : 1 } + Function's return value (output): ['a', 'number', 'hungry', 'grammyWins'] + Starter Code: -function getAllKeys(obj) { - // your code here -} */ function getAllKeys(obj){ - // your code here + //your code here + } diff --git a/exercises/003.js b/exercises/003.js index 8f0a5d4..8f963ee 100644 --- a/exercises/003.js +++ b/exercises/003.js @@ -12,6 +12,7 @@ Function's return value (output): } Do not change the input string. Assume that all elements in the array will be of type 'string'. +Do not use "Object.fromEntries" to solve this prompt. Note that the input may have a different number of elements than the given sample. For instance, if the input had 6 values instead of 4, your code should flexibly accommodate that. @@ -20,6 +21,6 @@ Starter Code: */ function fromListToObject(array) { - // your code here - + //your code here + } diff --git a/exercises/004.js b/exercises/004.js index caed05d..9178298 100644 --- a/exercises/004.js +++ b/exercises/004.js @@ -11,6 +11,7 @@ Example input: Function's return value (output): ['Krysten', 33, false] +Do not use "Object.values" to solve this prompt. Note that the input may have a different number of keys and values than the given sample. E.g. it should also handle an input like: @@ -28,6 +29,6 @@ Starter Code */ function listAllValues(obj) { - // your code here - -} \ No newline at end of file + //your code here + +} diff --git a/exercises/005.js b/exercises/005.js index eeccb70..588bd72 100644 --- a/exercises/005.js +++ b/exercises/005.js @@ -17,6 +17,7 @@ Given that input, the return value should look like this: {firstName: 'Mary', lastName: 'Jenkins', age: 36, role: 'manager'} ] +Do not use "Object.fromEntries" to solve this prompt. Note that the input may have a different number of rows or different keys than the given sample. For example, let's say the HR department adds a "tshirtSize" field to each employee record. Your code should flexibly accommodate that. @@ -25,6 +26,6 @@ Starter Code : */ function transformEmployeeData(array) { - // your code here - + //your code here + } diff --git a/exercises/006.js b/exercises/006.js index dca4c27..9107457 100644 --- a/exercises/006.js +++ b/exercises/006.js @@ -1,14 +1,17 @@ /* Write a function called "convertObjectToList" which converts an object literal into an array of arrays, like this: + Argument: { name: 'Holly', age: 35, role: 'producer' } + Return value: [['name', 'Holly'], ['age', 35], ['role', 'producer']] +Do not use "Object.entries" to solve this prompt. Note that your function should be able to handle ANY object like this, not just the exact sample provided above. E.g., it should also be able to handle this, or any other object containing simple key-value pairs. @@ -22,5 +25,6 @@ Starter Code: */ function convertObjectToList(obj) { - // your code here -} \ No newline at end of file + //your code here + +} diff --git a/exercises/007.js b/exercises/007.js index 094e8b5..47b8d2a 100644 --- a/exercises/007.js +++ b/exercises/007.js @@ -24,7 +24,6 @@ Notes: * Your function should not alter the customerData object to update the number of visits. * Do not hardcode to the exact sample data. This is a BAD IDEA: - if (firstName === 'Joe') { // do something } @@ -49,8 +48,7 @@ var customerData = { function greetCustomer(firstName) { var greeting = ''; - // your code here - + //your code here + return greeting; } -