From 984ba169021e094e36052cae865ac2086d411313 Mon Sep 17 00:00:00 2001 From: shyye Date: Fri, 20 Sep 2024 09:37:28 +0200 Subject: [PATCH 1/6] Test --- src/declaration.js | 2 ++ 1 file changed, 2 insertions(+) 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 f472798fbff137f110606d1bcd4ef0ba54c876fd Mon Sep 17 00:00:00 2001 From: shyye Date: Fri, 20 Sep 2024 09:54:46 +0200 Subject: [PATCH 2/6] Fix assignment.js --- src/assignment.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/assignment.js b/src/assignment.js index a2f2b63..4dbf582 100644 --- a/src/assignment.js +++ b/src/assignment.js @@ -3,9 +3,10 @@ let firstNumber = 10 firstNumber = 0 // TODO: 1. Set the value of firstNumber below so the tests pass +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 = { From 00a2a10d9040ab2ae2e02fcada244e7df01e491d Mon Sep 17 00:00:00 2001 From: shyye Date: Fri, 20 Sep 2024 10:00:42 +0200 Subject: [PATCH 3/6] Fix format for swap.js --- .husky/pre-commit | 4 ---- src/advanced/swap.js | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100644 index 6b54e0b..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npx eslint src diff --git a/src/advanced/swap.js b/src/advanced/swap.js index 7908a03..992b47e 100644 --- a/src/advanced/swap.js +++ b/src/advanced/swap.js @@ -1,5 +1,5 @@ -let a = 8 -let b = 10 +const a = 8 +const 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 From edf9a9a2920760025ef243a2d6d3a362f69a4818 Mon Sep 17 00:00:00 2001 From: shyye Date: Fri, 20 Sep 2024 10:08:07 +0200 Subject: [PATCH 4/6] Fix types.js --- src/extensions/types.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/extensions/types.js b/src/extensions/types.js index ce48367..853e741 100644 --- a/src/extensions/types.js +++ b/src/extensions/types.js @@ -35,34 +35,34 @@ 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(6) // 4. Pick an array -const anArray = pick(1) +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(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 809ac4f79e5c1dc4abde38219ac2e8bb5e5d0875 Mon Sep 17 00:00:00 2001 From: shyye Date: Fri, 20 Sep 2024 10:10:32 +0200 Subject: [PATCH 5/6] Restore the variables that causes eslint error again --- src/advanced/swap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/advanced/swap.js b/src/advanced/swap.js index 992b47e..7908a03 100644 --- a/src/advanced/swap.js +++ b/src/advanced/swap.js @@ -1,5 +1,5 @@ -const a = 8 -const b = 10 +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 From 4375636da81a8d5fd210f6d74ba9e4e205cc3220 Mon Sep 17 00:00:00 2001 From: shyye Date: Fri, 20 Sep 2024 10:22:20 +0200 Subject: [PATCH 6/6] Fix swap.js --- src/advanced/swap.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/advanced/swap.js b/src/advanced/swap.js index 7908a03..8c9e340 100644 --- a/src/advanced/swap.js +++ b/src/advanced/swap.js @@ -1,6 +1,13 @@ -let a = 8 -let b = 10 +const a = 8 +const 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 -module.exports = { a, b } +// Destructiong assignment +// - resource: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment +// [a,b] = [b,a] + +module.exports = { + a: b, + b: a +}