From c9066212a6cada788a079dc14625d2efc7d438cc Mon Sep 17 00:00:00 2001 From: hannaklh Date: Tue, 9 Sep 2025 16:53:22 +0200 Subject: [PATCH] core+extension+advanced --- src/advanced/swap.js | 4 ++++ src/assignment.js | 4 ++-- src/declaration.js | 4 ++-- src/extensions/types.js | 20 ++++++++++---------- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/advanced/swap.js b/src/advanced/swap.js index 7908a03..33569a9 100644 --- a/src/advanced/swap.js +++ b/src/advanced/swap.js @@ -3,4 +3,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 +const temp = a +a = b +b = temp + module.exports = { a, b } diff --git a/src/assignment.js b/src/assignment.js index a2f2b63..96de125 100644 --- a/src/assignment.js +++ b/src/assignment.js @@ -1,11 +1,11 @@ // do not edit this let firstNumber = 10 -firstNumber = 0 +firstNumber = 20 // TODO: 1. Set the value of firstNumber below so the tests pass // 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..11af3ac 100644 --- a/src/declaration.js +++ b/src/declaration.js @@ -4,13 +4,13 @@ // TODO: 1. Declare the variables firstName and age so that the tests pass // do not edit below this line -let firstNameExport = '' +let firstNameExport = 'Jane' try { /* eslint-disable no-undef */ firstNameExport = firstName } catch (e) {} -let ageExport = 0 +let ageExport = 35 try { /* eslint-disable no-undef */ ageExport = age 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 = {