From f92f8ba1d98e0287b8a47c53619b71c36aa50ebc Mon Sep 17 00:00:00 2001 From: Dag Andreas Date: Fri, 20 Sep 2024 14:42:18 +0200 Subject: [PATCH 1/3] completed tasks --- src/assignment.js | 6 ++++-- src/declaration.js | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/assignment.js b/src/assignment.js index a2f2b63..55fba79 100644 --- a/src/assignment.js +++ b/src/assignment.js @@ -2,10 +2,12 @@ let firstNumber = 10 firstNumber = 0 -// TODO: 1. Set the value of firstNumber below so the tests pass +// TODO: 1. Set the value of firstNumber below so the tests passnp + firstNumber = 20 + // TODO: 2. Change the code below so that the tests pass -const secondNumber = 0 // edit this value +const secondNumber = 42 // edit this value // do not edit the exported object. module.exports = { diff --git a/src/declaration.js b/src/declaration.js index 80daf64..46e6950 100644 --- a/src/declaration.js +++ b/src/declaration.js @@ -2,6 +2,8 @@ // // // TODO: 1. Declare the variables firstName and age so that the tests pass +const firstName = 'Jane' +const age = 35 // do not edit below this line let firstNameExport = '' From fcff367192438dd01198036e72e05520f6c8aaf8 Mon Sep 17 00:00:00 2001 From: Dag Andreas Date: Tue, 24 Sep 2024 08:46:53 +0200 Subject: [PATCH 2/3] completed --- src/advanced/swap.js | 3 +++ src/assignment.js | 3 +-- src/extensions/types.js | 16 ++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/advanced/swap.js b/src/advanced/swap.js index 7908a03..145f9ad 100644 --- a/src/advanced/swap.js +++ b/src/advanced/swap.js @@ -2,5 +2,8 @@ let a = 8 let b = 10 // TODO: Swap the values of a and b without changing lines 1 and 2; extra points if you can do it without using a temporary variable +a = a + b // a + b a(18) +b = a - b // a b(18-10=8) +a = a - b // a = (10 + 8) - (8) a = 10 module.exports = { a, b } diff --git a/src/assignment.js b/src/assignment.js index 55fba79..5957521 100644 --- a/src/assignment.js +++ b/src/assignment.js @@ -3,8 +3,7 @@ let firstNumber = 10 firstNumber = 0 // TODO: 1. Set the value of firstNumber below so the tests passnp - firstNumber = 20 - +firstNumber = 20 // TODO: 2. Change the code below so that the tests pass const secondNumber = 42 // edit this value diff --git a/src/extensions/types.js b/src/extensions/types.js index ce48367..f36699b 100644 --- a/src/extensions/types.js +++ b/src/extensions/types.js @@ -35,16 +35,16 @@ function pick(n) { } // 1. Pick true using the pick function - by changing 0 to pick your answer -const imTrue = pick(0) +const imTrue = pick(9) // 2. Pick a real number -const aReal = pick(0) +const aReal = pick(4) // ? // 3. Pick a string -const aString = pick(3) +const aString = pick(0) // 4. Pick an array -const anArray = pick(1) +const anArray = pick(7) // 5. Pick a (simple) number const aNumber = pick(0) @@ -53,16 +53,16 @@ const aNumber = pick(0) const anObject = pick(1) // 7. Pick false -const imFalse = pick(0) +const imFalse = pick(10) // 8. Pick a BigInt -const imBigInt = pick(1) +const imBigInt = pick(5) // 9. Pick undefined -const imUndefined = pick(0) +const imUndefined = pick(2) // 10. Pick null -const imNull = pick(0) +const imNull = pick(1) // Do not edit below this line module.exports = { From a6551b65bb3dbc087550e25229137bbf454f8983 Mon Sep 17 00:00:00 2001 From: Dag Andreas Date: Tue, 24 Sep 2024 09:18:28 +0200 Subject: [PATCH 3/3] completed ext --- src/extensions/types.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extensions/types.js b/src/extensions/types.js index f36699b..94e7721 100644 --- a/src/extensions/types.js +++ b/src/extensions/types.js @@ -41,16 +41,16 @@ const imTrue = pick(9) const aReal = pick(4) // ? // 3. Pick a string -const aString = pick(0) +const aString = pick(6) // 4. Pick an array const anArray = pick(7) // 5. Pick a (simple) number -const aNumber = pick(0) +const aNumber = pick(3) // 6. Pick an object -const anObject = pick(1) +const anObject = pick(8) // 7. Pick false const imFalse = pick(10)