├── .DS_Store
├── 01 - Getting started
├── gettingStarted.js
└── index.html
├── 02 - Javascript basics
├── 01.js
├── 02.js
├── 03.js
├── 04.js
├── 05.js
├── 06.js
├── 07.js
├── 08.js
├── 09.js
├── 10.js
├── 11.js
├── 12.js
└── 13.js
├── 03 - Javascript arrays
├── 01.js
├── 02.js
├── 03.js
├── 04.js
├── 05.js
├── 06.js
├── 07.js
├── 08.js
├── 09.js
├── 10.js
└── 11.js
├── 04 - Javascript dates
├── 01.js
├── 02.js
├── 03.js
├── 04.js
├── 05.js
├── 06.js
├── 07.js
└── 08.js
├── 05 - Javascript objects
├── 01.js
├── 02.js
├── 03.js
├── 04.js
├── 05.js
├── 06.js
├── 07.js
├── 08.js
└── 09.js
├── 06 - Javascript Sets
├── 01.js
├── 02.js
├── 03.js
├── 04.js
├── 05.js
├── 06.js
└── 07.js
├── README.md
└── README
└── logo.png
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kvdos/JSchallenger/29c4648bd07c61b2813eb89c1a3f93d00bb5ac8e/.DS_Store
--------------------------------------------------------------------------------
/01 - Getting started/gettingStarted.js:
--------------------------------------------------------------------------------
1 | // Simply return the given input
2 | function myFunctionInput(input) {
3 | return input;
4 | }
5 |
6 | console.log(myFunctionInput(123)); // 123
7 | console.log(myFunctionInput("123")); // "123"
8 |
9 | /////////////////////////////////////////////////////////
10 |
11 | // Find the maximum number of an array
12 | function myFunctionMaxNum(input) {
13 | return Math.max(...input);
14 | }
15 |
16 | console.log(myFunctionMaxNum([1, 2, 3]));
17 | console.log(myFunctionMaxNum([10, 1000, 100]));
18 | console.log(myFunctionMaxNum([-10, -2, -11]));
19 |
--------------------------------------------------------------------------------
/01 - Getting started/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/02 - Javascript basics/01.js:
--------------------------------------------------------------------------------
1 | // Check if a number is even
2 |
3 | // Write a function that takes a number as argument
4 | // If the number is even, return true
5 | // Otherwise, return false
6 |
7 | function myFunction(num) {
8 | return num % 2 === 0;
9 | }
10 |
11 | console.log(myFunction(10)); // true
12 | console.log(myFunction(-4)); // true
13 | console.log(myFunction(5)); // false
14 | console.log(myFunction(-111)); // false
15 |
--------------------------------------------------------------------------------
/02 - Javascript basics/02.js:
--------------------------------------------------------------------------------
1 | // Multiplication, division, and comparison operators
2 |
3 | // Write a function that takes two numbers, say a and b, as arguments
4 | // If a is smaller than b, divide a by b
5 | // Otherwise, multiply both numbers
6 | // Return the resulting value
7 |
8 | function myFunction(a, b) {
9 | return a < b ? a / b : a * b;
10 | }
11 |
12 | console.log(myFunction(10, 100)); // 0.1
13 | console.log(myFunction(90, 45)); // 4050
14 | console.log(myFunction(2, 0.5)); // 1
15 |
--------------------------------------------------------------------------------
/02 - Javascript basics/03.js:
--------------------------------------------------------------------------------
1 | // Comparison operators, strict equality
2 |
3 | // Write a function that takes two values, say a and b, as arguments
4 | // Return true if the two values are equal and of the same type
5 |
6 | function myFunction(a, b) {
7 | return a === b;
8 | }
9 |
10 | console.log(myFunction(2, 3)); // false
11 | console.log(myFunction(3, 3)); // true
12 | console.log(myFunction(1, "1")); // false
13 | console.log(myFunction("10", "10")); // true
14 |
--------------------------------------------------------------------------------
/02 - Javascript basics/04.js:
--------------------------------------------------------------------------------
1 | // Check if a number is a whole number
2 |
3 | // Write a function that takes a number as argument
4 | // If the number is a whole number (has no decimal place), return true
5 | // Otherwise, return false
6 |
7 | function myFunction(num) {
8 | // return Number.isInteger(num);
9 | // return num % 1 !== 0;
10 | return Math.floor(num) === num;
11 |
12 | // AUTHOR'S:
13 | // return num - Math.floor(num) === 0
14 | }
15 |
16 | console.log(myFunction(4)); // true
17 | console.log(myFunction(1.123)); // false
18 | console.log(myFunction(1048)); // true
19 | console.log(myFunction(10.48)); // false
20 |
--------------------------------------------------------------------------------
/02 - Javascript basics/05.js:
--------------------------------------------------------------------------------
1 | // Check whether a string contains another string and concatenates
2 |
3 | // Write a function that takes two strings, say a and b, as arguments
4 | // If a contains b, append b to the beginning of a
5 | // If not, append it to the end
6 | // Return the concatenation
7 |
8 | function myFunction(a, b) {
9 | return a.includes(b) ? b + a : a + b;
10 |
11 | // AUTHOR'S:
12 | // return a.indexOf(b) !== -1 ? b + a : a + b;
13 | }
14 |
15 | console.log(myFunction("cheese", "cake")); // "cheesecake"
16 | console.log(myFunction("lips", "s")); // "slips"
17 | console.log(myFunction("Java", "script")); // "Javascript"
18 |
--------------------------------------------------------------------------------
/02 - Javascript basics/06.js:
--------------------------------------------------------------------------------
1 | // Find next higher natural number that is divisble by y
2 |
3 | // Write a function that takes two numbers, say x and y, as arguments
4 | // Check if x is divisible by y
5 | // If yes, return x
6 | // If not, return the next higher natural number that is divisible by y
7 |
8 | function myFunction(x, y) {
9 | while (x % y !== 0) x++;
10 | return x;
11 | }
12 |
13 | console.log(myFunction(1, 23)); // 23
14 | console.log(myFunction(23, 23)); // 23
15 | console.log(myFunction(7, 3)); // 9
16 | console.log(myFunction(-5, 7)); // 0
17 |
--------------------------------------------------------------------------------
/02 - Javascript basics/07.js:
--------------------------------------------------------------------------------
1 | // Round a number to 2 decimal places
2 |
3 | // Write a function that takes a number as argument
4 | // Round the number to the 2nd digit after the comma
5 | // Return the rounded number
6 |
7 | function myFunction(num) {
8 | return Math.round(num * 100) / 100;
9 |
10 | // AUTHOR'S:
11 | // return Number(num.toFixed(2));
12 | }
13 |
14 | console.log(myFunction(2.12397)); // 2.12
15 | console.log(myFunction(3.136)); // 3.14
16 | console.log(myFunction(26.1379)); // 26.14
17 |
--------------------------------------------------------------------------------
/02 - Javascript basics/08.js:
--------------------------------------------------------------------------------
1 | // Split a number into its digits
2 |
3 | // Write a function that takes a number as argument
4 | // The function should split the number into its individual digits and return them in an array
5 | // Tipp: you might want to change the type of the number for the splitting
6 |
7 | function myFunction(num) {
8 | const arr = num.toString().split("");
9 | return arr.map((num) => +num);
10 |
11 | // AUTHOR'S:
12 | // const string = num + '';
13 | // const strings = string.split('');
14 | // return strings.map(digit => Number(digit))
15 | }
16 |
17 | console.log(myFunction(193278)); // [1,9,3,2,7,8]
18 |
--------------------------------------------------------------------------------
/02 - Javascript basics/09.js:
--------------------------------------------------------------------------------
1 | // Find the correct word by incrementing letters in alphabet
2 |
3 | // Write a function that takes a string as argument
4 | // As it is, the string has no meaning
5 | // Increment each letter to the next letter in the alphabet
6 | // Return the correct word
7 |
8 | function myFunction(str) {
9 | return str
10 | .split("")
11 | .map((char) => String.fromCharCode(char.charCodeAt() + 1))
12 | .join("");
13 |
14 | // AUTHOR'S:
15 | // const arr = [...str];
16 | // const correctedArray = arr.map(e => String.fromCharCode(e.charCodeAt()+1));
17 | // return correctedArray.join('');
18 | }
19 |
20 | console.log(myFunction("bnchmf")); // coding
21 |
--------------------------------------------------------------------------------
/02 - Javascript basics/10.js:
--------------------------------------------------------------------------------
1 | // Clear up the chaos behind these strings
2 |
3 | // It seems like something happened to these strings
4 | // Can you figure out how to clear up the chaos?
5 | // Write a function that joins these strings together such that they form the words 'Javascript', 'Countryside',
6 | // and 'Downtown'!
7 | // You might want to apply basic JS string methods such as replace(), split(), slice() etc
8 |
9 | function myFunction(a, b) {
10 | const str = a.concat(b.split("").reverse().join("")).replaceAll("%", "");
11 | return str[0].toUpperCase() + str.slice(1);
12 |
13 | // AUTHOR'S:
14 | // const first = a.split('').map(part => part.replace('%', '')).join('');
15 | // const second = b.split('').reverse().map(part => part.replace('%', '')).join('');
16 | // return first.charAt(0).toUpperCase() + first.slice(1) + second
17 | }
18 |
19 | console.log(myFunction("java", "tpi%rcs")); // 'Javascript'
20 | console.log(myFunction("c%ountry", "edis")); // 'Countryside'
21 | console.log(myFunction("do%wn", "nw%ot")); // 'Downtown'
22 |
--------------------------------------------------------------------------------
/02 - Javascript basics/11.js:
--------------------------------------------------------------------------------
1 | // Return the percentage of a number
2 |
3 | // Write a function that takes an object with the properties number and percentage as argument
4 | // Return the given percentage of the number
5 |
6 | function myFunction(obj) {
7 | return Math.round(obj.number * (obj.percentage / 100) * 100) / 100;
8 | }
9 |
10 | // AUTHOR'S:
11 | // function myFunction({ number, percentage }) {
12 | // return (number / 100) * percentage;
13 | // }
14 |
15 | console.log(myFunction({ number: 100, percentage: 50 })); // 50
16 | console.log(myFunction({ number: 777, percentage: 2 })); // 15.54
17 | console.log(myFunction({ number: 500, percentage: 99 })); // 495
18 |
--------------------------------------------------------------------------------
/02 - Javascript basics/12.js:
--------------------------------------------------------------------------------
1 | // How many times does a character occur?
2 |
3 | // Write a function that takes two strings as arguments
4 | // Return the number of times the first string occurs in the second string
5 | function myFunction(a, b) {
6 | return b
7 | .toLowerCase()
8 | .split("")
9 | .filter((el) => el === a).length;
10 |
11 | // AUTHOR'S:
12 | // return b.toLowerCase().split(a).length - 1;
13 | }
14 |
15 | console.log(
16 | myFunction("m", "How many times does the character occur in this sentence?")
17 | ); // 2
18 | console.log(
19 | myFunction("h", "How many times does the character occur in this sentence?")
20 | ); // 4
21 | console.log(
22 | myFunction("z", "How many times does the character occur in this sentence?")
23 | ); // 0
24 |
--------------------------------------------------------------------------------
/02 - Javascript basics/13.js:
--------------------------------------------------------------------------------
1 | // Return the next higher prime number
2 |
3 | // This challenge is a little bit more complex
4 | // Write a function that takes a number as argument
5 | // If the number is prime, return the number
6 | // If not, return the next higher prime number
7 |
8 | function myFunction(num) {
9 | let counter = 0;
10 | do {
11 | counter = 0;
12 | for (let i = 2; i <= num; i++) {
13 | if (num % i === 0) counter++;
14 | }
15 | num++;
16 | } while (counter > 1);
17 | return num - 1;
18 | }
19 |
20 | // AUTHOR'S:
21 | // function myFunction( input ) {
22 | // function isPrime(num) {
23 | // for (let i = 2; i <= Math.sqrt(num); i++) {
24 | // if (num % i === 0) return false;
25 | // }
26 | // return num > 1;
27 | // }
28 | // let n = input;
29 | // while (!isPrime(n)) n++;
30 | // return n
31 | // }
32 |
33 | console.log(myFunction(38)); // 41
34 | console.log(myFunction(7)); // 7
35 | console.log(myFunction(115)); // 127
36 | console.log(myFunction(2000)); // 2003
37 |
--------------------------------------------------------------------------------
/03 - Javascript arrays/01.js:
--------------------------------------------------------------------------------
1 | // Sort an array of strings alphabetically
2 |
3 | // Write a function that takes an array of strings as argument
4 | // It should return the array with its values sorted alphabetically
5 |
6 | function myFunction(arr) {
7 | return arr.sort();
8 | }
9 |
10 | console.log(myFunction(["b", "c", "d", "a"])); // ['a', 'b', 'c', 'd']
11 | console.log(myFunction(["z", "c", "d", "a", "y", "a", "w"])); // ['a', 'a', 'c', 'd', 'w', 'y', 'z']
12 |
--------------------------------------------------------------------------------
/03 - Javascript arrays/02.js:
--------------------------------------------------------------------------------
1 | // Sort an array of numbers in descending order
2 |
3 | // Write a function that takes an array of numbers as argument
4 | // It should return an array with the numbers sorted in descending order
5 |
6 | function myFunction(arr) {
7 | return arr.sort((a, b) => b - a);
8 | }
9 |
10 | console.log(myFunction([1, 3, 2])); // [3,2,1]
11 | console.log(myFunction([4, 2, 3, 1])); // [4,3,2,1]
12 |
--------------------------------------------------------------------------------
/03 - Javascript arrays/03.js:
--------------------------------------------------------------------------------
1 | // Return last n array elements
2 |
3 | // Write a function that takes an array and a number (n) as arguments
4 | // It should return the last n array elements
5 | // If the array has less than n elements, return all
6 |
7 | function myFunction(arr, n) {
8 | return arr.splice(-n);
9 |
10 | // AUTHOR'S
11 | // return arr.slice(-n);
12 | }
13 |
14 | console.log(myFunction([1, 2, 3, 4, 5], 2)); // [4, 5]
15 | console.log(myFunction([1, 2, 3], 6)); // [1, 2, 3]
16 | console.log(myFunction([1, 2, 3, 4, 5, 6, 7, 8], 3)); // [6, 7, 8]
17 |
--------------------------------------------------------------------------------
/03 - Javascript arrays/04.js:
--------------------------------------------------------------------------------
1 | // Sum up all array elements with values greater than
2 |
3 | // Write a function that takes an array and a number, say num, as arguments
4 | // Sum up all array elements with a value greater than num
5 | // Return the sum
6 |
7 | function myFunction(arr, num) {
8 | return arr.filter((el) => el > num).reduce((acc, cur) => acc + cur);
9 |
10 | // AUTHOR'S:
11 | // return arr.reduce((sum, cur) => {
12 | // if (cur > num) return sum + cur;
13 | // return sum;
14 | // }, 0);
15 | }
16 |
17 | console.log(myFunction([1, 2, 3, 4, 5, 6, 7], 2)); // 25
18 | console.log(myFunction([-10, -11, -3, 1, -4], -3)); // 1
19 | console.log(myFunction([78, 99, 100, 101, 401], 99)); // 602
20 |
--------------------------------------------------------------------------------
/03 - Javascript arrays/05.js:
--------------------------------------------------------------------------------
1 | // Return the average of an array of numbers
2 |
3 | // Write a function that takes an array of numbers as argument
4 | // It should return the average of the numbers
5 |
6 | function myFunction(arr) {
7 | return arr.reduce((acc, cur) => acc + cur, 0) / arr.length;
8 | }
9 |
10 | console.log(myFunction([10, 100, 40])); // 50
11 | console.log(myFunction([10, 100, 1000])); // 370
12 | console.log(myFunction([-50, 0, 50, 200])); // 50
13 |
--------------------------------------------------------------------------------
/03 - Javascript arrays/06.js:
--------------------------------------------------------------------------------
1 | // Check if all array elements are equal
2 |
3 | // Write a function that takes an array as argument
4 | // It should return true if all elements in the array are equal
5 | // It should return false otherwise
6 |
7 | function myFunction(arr) {
8 | return arr.every((el) => el === arr[0]);
9 |
10 | // AUTHOR'S:
11 | // return new Set(arr).size === 1;
12 | }
13 |
14 | console.log(myFunction([true, true, true, true])); // true
15 | console.log(myFunction(["test", "test", "test"])); // true
16 | console.log(myFunction([1, 1, 1, 2])); // false
17 | console.log(myFunction(["10", 10, 10, 10])); // false
18 |
--------------------------------------------------------------------------------
/03 - Javascript arrays/07.js:
--------------------------------------------------------------------------------
1 | // Remove a specific array element
2 |
3 | // Write a function that takes an array and a value as argument
4 | // The function should clean the array from all occurrences of the given value and return the the cleaned version
5 |
6 | function myFunction(arr, val) {
7 | return arr.filter((el) => el !== val);
8 | }
9 |
10 | console.log(myFunction([1, 2, 3], 2)); // [1, 3]
11 | console.log(myFunction([1, 2, "2"], "2")); // [1, 2]
12 | console.log(myFunction([false, "2", 1], false)); // ['2', 1]
13 | console.log(myFunction([1, 2, "2", 1], 1)); // [2, '2']
14 |
--------------------------------------------------------------------------------
/03 - Javascript arrays/08.js:
--------------------------------------------------------------------------------
1 | // Create a range of numbers
2 |
3 | // Write a function that takes two numbers, say min and max, as arguments
4 | // Return an array of numbers in the range min to max
5 |
6 | function myFunction(min, max) {
7 | const arr = [];
8 | for (let i = min; i <= max; i++) arr.push(i);
9 | return arr;
10 | }
11 |
12 | console.log(myFunction(2, 10)); // [2, 3, 4, 5, 6, 7, 8, 9, 10]
13 | console.log(myFunction(1, 3)); // [1, 2, 3]
14 | console.log(myFunction(-5, 5)); // [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
15 | console.log(myFunction(2, 7)); // [2, 3, 4, 5, 6, 7]
16 |
--------------------------------------------------------------------------------
/03 - Javascript arrays/09.js:
--------------------------------------------------------------------------------
1 | // Return the longest string from an array of strings
2 |
3 | // Write a function that takes an array of strings as argument
4 | // It should return the longest string
5 |
6 | // function myFunction(arr) {
7 | // return arr.reduce((acc, cur) => {
8 | // if (cur.length > acc.length) return (acc = cur);
9 | // return acc;
10 | // }, "");
11 | // }
12 |
13 | // function myFunction(arr) {
14 | // let acc = "";
15 |
16 | // arr.forEach((el) => {
17 | // if (el.length > acc.length) acc = el;
18 | // });
19 |
20 | // return acc;
21 | // }
22 |
23 | // AUTHOR'S:
24 | function myFunction(arr) {
25 | return arr.reduce((acc, cur) => (acc.length <= cur.length ? cur : acc));
26 | }
27 |
28 | console.log(myFunction(["help", "me"])); // 'help'
29 | console.log(myFunction(["I", "need", "candy"])); // 'candy'
30 |
--------------------------------------------------------------------------------
/03 - Javascript arrays/10.js:
--------------------------------------------------------------------------------
1 | // Merge an arbitrary number of arrays
2 |
3 | // Write a function that takes arguments an arbitrary number of arrays
4 | // It should return an array containing the values of all arrays
5 |
6 | function myFunction(...arr) {
7 | return arr.flat();
8 | }
9 |
10 | console.log(myFunction([1, 2, 3], [4, 5, 6])); // [1, 2, 3, 4, 5, 6]
11 | console.log(myFunction(["a", "b", "c"], [4, 5, 6])); // ['a', 'b', 'c', 4, 5, 6]
12 | console.log(myFunction([true, true], [1, 2], ["a", "b"])); // [true, true, 1, 2, 'a', 'b']
13 |
--------------------------------------------------------------------------------
/03 - Javascript arrays/11.js:
--------------------------------------------------------------------------------
1 | function myFunction(a, b) {
2 | // return Array.from(new Set([...a, ...b])).sort((a, b) => a - b);
3 |
4 | // const arr = [];
5 | // a.concat(b).forEach((el) => {
6 | // if (!arr.includes(el)) arr.push(el);
7 | // });
8 | // return arr.sort((a, b) => a - b);
9 |
10 | // AUTHOR'S:
11 | return [...new Set([...a, ...b])].sort((a, b) => a - b);
12 | }
13 |
14 | console.log(myFunction([1, 2, 3], [3, 4, 5])); // [1, 2, 3, 4, 5]
15 | console.log(myFunction([-10, 22, 333, 42], [-11, 5, 22, 41, 42])); // [-11, -10, 5, 22, 41, 42, 333]
16 |
--------------------------------------------------------------------------------
/04 - Javascript dates/01.js:
--------------------------------------------------------------------------------
1 | // Check if two dates fall on the exact same day
2 |
3 | // Write a function that takes two date instances as argument
4 | // It should return true if they fall on the exact same day
5 | // It should return false otherwise
6 |
7 | function myFunction(a, b) {
8 | return a.getTime() === b.getTime();
9 |
10 | // return +a === +b;
11 |
12 | // AUTHOR'S:
13 | // return (
14 | // a.getFullYear() === b.getFullYear() &&
15 | // a.getMonth() === b.getMonth() &&
16 | // a.getDate() === b.getDate()
17 | // );
18 | }
19 |
20 | console.log(myFunction(new Date("2000/01/01"), new Date("2000/01/01"))); // true
21 | console.log(myFunction(new Date("2000/01/01"), new Date("2000/01/02"))); // false
22 | console.log(myFunction(new Date("2001/01/01"), new Date("2000/01/01"))); // false
23 | console.log(myFunction(new Date("2000/11/01"), new Date("2000/01/01"))); // false
24 |
--------------------------------------------------------------------------------
/04 - Javascript dates/02.js:
--------------------------------------------------------------------------------
1 | // Check if two dates are equal
2 |
3 | // Sounds easy, but you need to know the trick
4 | // Write a function that takes two date instances as argument
5 | // It should return true if the dates are equal
6 | // It should return false otherwise
7 |
8 | function myFunction(a, b) {
9 | // return a.getTime() === b.getTime();
10 |
11 | return +a === +b;
12 | }
13 |
14 | console.log(
15 | myFunction(new Date("2000/01/01 08:00:00"), new Date("2000/01/01 08:45:00"))
16 | ); // false
17 | console.log(
18 | myFunction(new Date("2000/01/01 08:00:00"), new Date("2000/01/01 08:00:00"))
19 | ); // true
20 | console.log(
21 | myFunction(new Date("2001/01/01 08:00:00"), new Date("2000/01/01 08:00:00"))
22 | ); // false
23 |
--------------------------------------------------------------------------------
/04 - Javascript dates/03.js:
--------------------------------------------------------------------------------
1 | // Check if one date is earlier than another
2 |
3 | // Write a function that takes as argument an object with the properties a and b, each containing a date instance
4 | // It should return true if date a is earlier than date b
5 | // It should return false otherwise
6 |
7 | function myFunction({ a, b }) {
8 | return +a < +b;
9 |
10 | // return a.getTime() < b.getTime();
11 |
12 | // AUTHOR'S:
13 | // return a < b
14 | }
15 |
16 | console.log(
17 | myFunction({
18 | a: new Date("2000/01/01 08:00:00"),
19 | b: new Date("2000/01/01 08:45:00"),
20 | })
21 | ); // true
22 | console.log(
23 | myFunction({
24 | a: new Date("2000/01/01 08:45:00"),
25 | b: new Date("2000/01/01 08:00:00"),
26 | })
27 | ); // false
28 | console.log(
29 | myFunction({
30 | a: new Date("2000/01/01 08:00:00"),
31 | b: new Date("2000/01/01 08:00:00"),
32 | })
33 | ); // false
34 |
--------------------------------------------------------------------------------
/04 - Javascript dates/04.js:
--------------------------------------------------------------------------------
1 | // Add n days to an existing date
2 |
3 | // Write a function that takes as argument an object with the properties date and daysToAdd, containing a Javascript date and a number
4 | // It should add daysToAdd days to the date and return the number of milliseconds since January 1, 1970, 00:00:00 UTC
5 |
6 | function myFunction({ date, daysToAdd }) {
7 | return date.setDate(date.getDate() + daysToAdd);
8 | }
9 |
10 | console.log(
11 | myFunction({ date: new Date(Date.UTC(2000, 01, 01)), daysToAdd: 31 })
12 | ); // 952041600000
13 | console.log(
14 | myFunction({ date: new Date(Date.UTC(2000, 01, 01)), daysToAdd: 10 })
15 | ); // 950227200000
16 | console.log(
17 | myFunction({ date: new Date(Date.UTC(2000, 02, 28)), daysToAdd: 2 })
18 | ); // 954374400000
19 |
--------------------------------------------------------------------------------
/04 - Javascript dates/05.js:
--------------------------------------------------------------------------------
1 | // Check if two dates are within 1 hour from each other
2 |
3 | // Write a function that takes two date instances as argument
4 | // It should return true if the difference between the dates is less than or equal to 1 hour
5 | // It should return false otherwise
6 |
7 | function myFunction(a, b) {
8 | // return Math.abs(+a - +b) <= 60 * 60 * 1000;
9 | return Math.abs(a.getTime() - b.getTime()) <= 60 * 60 * 1000;
10 |
11 | // AUTHOR'S:
12 | // return Math.abs( a - b) / 1000 / 60 <= 60;
13 | }
14 |
15 | console.log(
16 | myFunction(new Date("2000/01/01 08:00:00"), new Date("2000/01/01 08:45:00"))
17 | ); // true
18 | console.log(
19 | myFunction(new Date("2000/01/01 09:00:00"), new Date("2000/01/01 08:45:00"))
20 | ); // true
21 | console.log(
22 | myFunction(new Date("2000/01/01 08:00:00"), new Date("2000/01/01 09:45:00"))
23 | ); // false
24 | console.log(
25 | myFunction(new Date("2000/01/01 08:00:00"), new Date("2000/01/01 09:00:00"))
26 | ); // true
27 |
--------------------------------------------------------------------------------
/04 - Javascript dates/06.js:
--------------------------------------------------------------------------------
1 | // Return the number of days between two dates
2 |
3 | // Write a function that takes two date instances as argument
4 | // It should return the number of days that lies between those dates
5 |
6 | function myFunction(a, b) {
7 | return Math.abs(a - b) / 1000 / 60 / 60 / 24;
8 | }
9 |
10 | console.log(myFunction(new Date("2020-06-11"), new Date("2020-06-01"))); // 10
11 | console.log(myFunction(new Date("2000-01-01"), new Date("2020-06-01"))); // 7457
12 |
--------------------------------------------------------------------------------
/04 - Javascript dates/07.js:
--------------------------------------------------------------------------------
1 | // Calculate difference between two dates in hours, minutes, and seconds
2 |
3 | // This is a more difficult challenge
4 | // Write a function that takes two date instances as arguments
5 | // It should return an object with the properties 'hrs', 'min', and 'sec'
6 | // The corresponding values should display the absolute difference between the two dates in hours, minutes, and seconds
7 |
8 | function myFunction(a, b) {
9 | const hrs = Math.abs(a.getHours() - b.getHours());
10 | const min = Math.abs(a.getMinutes() - b.getMinutes());
11 | const sec = Math.abs(a.getSeconds() - b.getSeconds());
12 | return { hrs, min, sec };
13 |
14 | // AUTHOR'S:
15 | // const dif = Math.abs(a - b);
16 | // const hrs = Math.floor(dif / 1000 / 60 / 60);
17 | // const min = Math.floor(dif / 1000 / 60) % (hrs * 60 || 60);
18 | // const sec = Math.floor(dif / 1000) % (min * 60 + hrs * 60 * 60 || 60);
19 | // return { hrs, min, sec }
20 | }
21 |
22 | console.log(
23 | myFunction(new Date("2000/01/01 08:00:00"), new Date("2000/01/01 08:45:10"))
24 | ); // { hrs: 0, min: 45, sec: 10 }
25 |
26 | console.log(
27 | myFunction(new Date("2000/01/01 09:50:23"), new Date("2000/01/01 08:00:00"))
28 | ); // { hrs: 1, min: 50, sec: 23 }
29 |
30 | console.log(
31 | myFunction(new Date("2000/01/01 11:04:12"), new Date("2000/01/01 08:00:00"))
32 | ); // { hrs: 3, min: 4, sec: 12 }
33 |
--------------------------------------------------------------------------------
/04 - Javascript dates/08.js:
--------------------------------------------------------------------------------
1 | // Return the next nearest quarter hour of a date
2 |
3 | // Write a function that takes a Date instance as argument
4 | // It should return the next nearest quarter hour in minutes
5 | // For example, if the given date has the time 10:01 the function should return 15
6 |
7 | function myFunction(date) {
8 | const min = date.getMinutes();
9 | for (let i = 15; i <= 60; i += 15) {
10 | if (i - min > 0 && min < 45) return i;
11 | else if (min > 45) return 0;
12 | }
13 |
14 | // AUTHOR'S:
15 | // const quarter = 15 * 60 * 1000;
16 | // const closestQuarter = new Date(Math.round(date / quarter) * quarter);
17 | // const nextQuarter =
18 | // closestQuarter.getTime() < date.getTime()
19 | // ? new Date(closestQuarter.getTime() + quarter)
20 | // : closestQuarter;
21 | // return nextQuarter.getMinutes();
22 | }
23 |
24 | console.log(myFunction(new Date(2021, 8, 10, 15, 14, 00))); // 15
25 | console.log(myFunction(new Date(2021, 8, 10, 15, 31, 00))); // 45
26 | console.log(myFunction(new Date(2021, 8, 10, 15, 47, 00))); // 0
27 |
--------------------------------------------------------------------------------
/05 - Javascript objects/01.js:
--------------------------------------------------------------------------------
1 | // Accessing object properties two
2 |
3 | // Write a function that takes an object with two properties as argument
4 | // It should return the value of the property with key 'prop-2'
5 | // Tipp: you might want to use the square brackets property accessor
6 |
7 | function myFunction(obj) {
8 | return obj["prop-2"];
9 | }
10 |
11 | console.log(myFunction({ one: 1, "prop-2": 2 })); // 2
12 | console.log(myFunction({ "prop-2": "two", prop: "test" })); // 'two'
13 |
--------------------------------------------------------------------------------
/05 - Javascript objects/02.js:
--------------------------------------------------------------------------------
1 | // Accessing object properties one
2 |
3 | // Write a function that takes an object with two properties as argument
4 | // It should return the value of the property with key country
5 |
6 | function myFunction(obj) {
7 | return obj.country;
8 | }
9 |
10 | console.log(myFunction({ continent: "Asia", country: "Japan" })); // 'Japan'
11 | console.log(myFunction({ country: "Sweden", continent: "Europe" })); // 'Sweden'
12 |
--------------------------------------------------------------------------------
/05 - Javascript objects/03.js:
--------------------------------------------------------------------------------
1 | // Accessing object properties three
2 |
3 | // Write a function that takes a string and an object with two properties as arguments
4 | // It should return the value of the property with key equal to the value of the string
5 |
6 | function myFunction(obj, str) {
7 | return obj[str];
8 | }
9 |
10 | console.log(myFunction({ continent: "Asia", country: "Japan" }, "continent")); // 'Asia'
11 | console.log(myFunction({ country: "Sweden", continent: "Europe" }, "country")); // 'Sweden'
12 |
--------------------------------------------------------------------------------
/05 - Javascript objects/04.js:
--------------------------------------------------------------------------------
1 | // Remove a property from an object
2 |
3 | // Write a function that takes an object as argument
4 | // It should return an object with all original object properties but the property with key 'country'
5 |
6 | function myFunction(obj) {
7 | const { country, ...rest } = obj;
8 | return rest;
9 | }
10 |
11 | console.log(
12 | myFunction({ continent: "Asia", country: "Japan", region: "Kansai" })
13 | ); // { continent: 'Asia', region: 'Kansai' }
14 |
15 | console.log(
16 | myFunction({ country: "Sweden", continent: "Europe", planet: "Earth" })
17 | ); // { continent: 'Europe', planet: 'Earth' }
18 |
19 | console.log(
20 | myFunction({
21 | city: "Sacramento",
22 | state: "California",
23 | country: "USA",
24 | continent: "North America",
25 | })
26 | ); // { city: 'Sacramento', state: 'California', continent: 'North America' }
27 |
--------------------------------------------------------------------------------
/05 - Javascript objects/05.js:
--------------------------------------------------------------------------------
1 | // Swap object keys and values
2 |
3 | // Write a function that takes an object as argument
4 | // Somehow, the properties and keys of the object got mixed up
5 | // Swap the Javascript object's key with its values and return the resulting object
6 |
7 | function myFunction(obj) {
8 | const res = {};
9 | for (let key in obj) res[obj[key]] = key;
10 | return res;
11 |
12 | // AUTHOR'S:
13 | // return Object.keys(obj).reduce((acc, cur) => {
14 | // return { ...acc, [obj[cur]]: cur };
15 | // }, {});
16 | }
17 |
18 | console.log(
19 | myFunction({ bear: "animal", sow: "female", boar: "male", cub: "young" })
20 | ); // { animal: 'bear', female: 'sow', male: 'boar', young: 'cub' }
21 |
22 | console.log(
23 | myFunction({ sheep: "animal", ewe: "female", ram: "male", lamb: "young" })
24 | ); // { animal: 'sheep', female: 'ewe', male: 'ram', young: 'lamb' }
25 |
26 | console.log(myFunction({ Berlin: "city", Germany: "country" })); // { city: 'Berlin', country: 'Germany' }
27 |
--------------------------------------------------------------------------------
/05 - Javascript objects/06.js:
--------------------------------------------------------------------------------
1 | // Add property to each object in array
2 |
3 | // Write a function that takes an array of objects and a string as arguments
4 | // Add a property with key 'continent' and value equal to the string to each of the objects
5 | // Return the new array of objects
6 | // Tipp: try not to mutate the original array
7 |
8 | function myFunction(arr, str) {
9 | arr.map((obj) => (obj.continent = str));
10 | return arr;
11 |
12 | // arr.forEach(el => el.continent = str);
13 | // return arr;
14 |
15 | // for (let key in arr) arr[key] = { ...arr[key], continent: str };
16 | // return arr;
17 |
18 | // AUTHOR'S:
19 | // return arr.map((obj) => ({ ...obj, continent: str }));
20 | }
21 |
22 | console.log(
23 | myFunction(
24 | [
25 | { city: "Tokyo", country: "Japan" },
26 | { city: "Bangkok", country: "Thailand" },
27 | ],
28 | "Asia"
29 | )
30 | ); // [{ city: 'Tokyo', country: 'Japan', continent: 'Asia' }, { city: 'Bangkok', country: 'Thailand', continent: 'Asia' }]
31 |
32 | console.log(
33 | myFunction(
34 | [
35 | { city: "Stockholm", country: "Sweden" },
36 | { city: "Paris", country: "France" },
37 | ],
38 | "Europe"
39 | )
40 | ); // [{ city: 'Stockholm', country: 'Sweden', continent: 'Europe' }, { city: 'Paris', country: 'France', continent: 'Europe' }]
41 |
--------------------------------------------------------------------------------
/05 - Javascript objects/07.js:
--------------------------------------------------------------------------------
1 | // Merge two objects with matching keys
2 |
3 | // Write a function that takes two objects as arguments
4 | // Unfortunately, the property 'country' in the second object has the wrong key
5 | // It should be named 'city' instead
6 | // Merge both objects and correct the wrong property name
7 | // Return the resulting object
8 | // It should have the properties 'planet', 'continent', 'country', 'state', and 'city'
9 |
10 | function myFunction(a, b) {
11 | // for (let key in b)
12 | // if (key === "country") {
13 | // b.city = b[key];
14 | // delete b[key];
15 | // }
16 |
17 | // return { ...a, ...b };
18 |
19 | // AUTHOR'S:
20 | const { country, ...rest } = b;
21 | return { ...a, ...rest, city: country };
22 | }
23 |
24 | console.log(
25 | myFunction(
26 | { continent: "Europe", country: "Germany" },
27 | { planet: "Earth", country: "Munich", state: "Bavaria" }
28 | )
29 | ); // { continent: 'Europe', country: 'Germany', planet: 'Earth', state: 'Bavaria', city: 'Munich'}
30 |
31 | console.log(
32 | myFunction(
33 | { continent: "North America", country: "USA" },
34 | { planet: "Earth", country: "Los Angeles", state: "California" }
35 | )
36 | ); // { continent: 'North America', country: 'USA', planet: 'Earth', state: 'California', city: 'Los Angeles'}
37 |
--------------------------------------------------------------------------------
/05 - Javascript objects/08.js:
--------------------------------------------------------------------------------
1 | // Extracting information from objects
2 |
3 | // Write a function that takes an object as argument containing properties with personal information
4 | // Extract firstName, lastName, size, and weight if available
5 | // If size or weight is given transform the value to a string
6 | // Attach the unit cm to the size
7 | // Attach the unit kg to the weight
8 | // Return a new object with all available properties that we are interested in
9 |
10 | function myFunction(obj) {
11 | // const { fn, ln, size, weight, ...rest } = obj;
12 | // const newObj = { fn, ln };
13 | // if (size) newObj.size = `${size}cm`;
14 | // if (weight) newObj.weight = `${weight}kg`;
15 | // return newObj;
16 |
17 | //AUTHOR'S:
18 | return {
19 | fn: obj.fn,
20 | ln: obj.ln,
21 | ...(obj.size && { size: `${obj.size}cm` }),
22 | ...(obj.weight && { weight: `${obj.weight}kg` }),
23 | };
24 | }
25 |
26 | console.log(
27 | myFunction({ fn: "Lisa", ln: "Müller", age: 17, size: 175, weight: 67 })
28 | ); // {fn: 'Lisa', ln: 'Müller', size: '175cm', weight: '67kg'}
29 |
30 | console.log(
31 | myFunction({
32 | fn: "Martin",
33 | ln: "Harper",
34 | age: 26,
35 | email: "martin.harper@test.de",
36 | weight: 102,
37 | })
38 | ); // {fn: 'Martin', ln: 'Harper', weight: '102kg'}
39 |
40 | console.log(
41 | myFunction({ fn: "Andrew", ln: "Harper", age: 81, size: 175, weight: 71 })
42 | ); // {fn: 'Andrew', ln: 'Harper', size: '175cm', weight: '71kg'}
43 |
44 | console.log(
45 | myFunction({
46 | fn: "Matthew",
47 | ln: "Müller",
48 | age: 19,
49 | email: "matthew@mueller.de",
50 | })
51 | ); // {fn: 'Matthew', ln: 'Müller'}
52 |
--------------------------------------------------------------------------------
/05 - Javascript objects/09.js:
--------------------------------------------------------------------------------
1 | // Replace empty strings in object with null values
2 |
3 | // Write a function that takes an object as argument
4 | // Some of the property values contain empty strings
5 | // Replace empty strings and strings that contain only whitespace with null values
6 | // Return the resulting object
7 |
8 | function myFunction(obj) {
9 | // for (let key in obj)
10 | // (obj[key] === "" || obj[key] === " ") && (obj[key] = null);
11 | // return obj;
12 |
13 | // AUTHOR'S:
14 | const newObj = { ...obj };
15 | for (key in newObj) {
16 | if (newObj[key].trim() === "") newObj[key] = null;
17 | }
18 | return newObj;
19 | }
20 |
21 | console.log(myFunction({ a: "a", b: "b", c: "" })); // { a: 'a', b: 'b', c: null }
22 |
23 | console.log(myFunction({ a: "", b: "b", c: " ", d: "d" })); // { a: null, b: 'b', c: null, d: 'd' }
24 |
25 | console.log(myFunction({ a: "a", b: "b ", c: " ", d: "" })); // { a: 'a', b: 'b ', c: null, d: null }
26 |
--------------------------------------------------------------------------------
/06 - Javascript Sets/01.js:
--------------------------------------------------------------------------------
1 | // Check if value is present in Set
2 |
3 | // Write a function that takes a Set and a value as arguments
4 | // Check if the value is present in the Set
5 |
6 | function myFunction(set, val) {
7 | return set.has(val);
8 | }
9 |
10 | console.log(myFunction(new Set([1, 2, 3]), 2)); // true
11 | console.log(myFunction(new Set([123]), 2)); // false
12 | console.log(myFunction(new Set(["1", "2", "3"]), "2")); // true
13 | console.log(myFunction(new Set("123"), "2")); // true
14 |
--------------------------------------------------------------------------------
/06 - Javascript Sets/02.js:
--------------------------------------------------------------------------------
1 | // Convert a Set to Array
2 |
3 | // Write a function that takes a Set as argument
4 | // Convert the Set to an Array
5 | // Return the Array
6 |
7 | function myFunction(set) {
8 | return [...set];
9 | }
10 |
11 | console.log(myFunction(new Set([1, 2, 3]))); // [1, 2, 3]
12 |
13 | console.log(myFunction(new Set([123]))); // [123]
14 |
15 | console.log(myFunction(new Set(["1", "2", "3"]))); // ['1', '2', '3']
16 |
17 | console.log(myFunction(new Set("123"))); // ['1', '2', '3']
18 |
--------------------------------------------------------------------------------
/06 - Javascript Sets/03.js:
--------------------------------------------------------------------------------
1 | // Get union of two sets
2 |
3 | // Write a function that takes two Sets as arguments
4 | // Create the union of the two sets
5 | // Return the result
6 | // Tipp: try not to switch to Arrays, this would slow down your code
7 |
8 | function myFunction(a, b) {
9 | for (let el of b) a.add(el);
10 | return a;
11 |
12 | // AUTHOR'S:
13 | // const result = new Set(a);
14 | // b.forEach((el) => result.add(el));
15 | // return result;
16 | }
17 |
18 | console.log(myFunction(new Set("123"), new Set("234"))); // new Set('1234')
19 |
20 | console.log(myFunction(new Set([1, 2, 3]), new Set([3, 4, 5]))); // new Set([1, 2, 3, 4, 5])
21 |
22 | console.log(
23 | myFunction(new Set([false, false, NaN]), new Set([true, true, NaN]))
24 | ); // new Set([false, NaN, true])
25 |
--------------------------------------------------------------------------------
/06 - Javascript Sets/04.js:
--------------------------------------------------------------------------------
1 | // Creating Javascript Sets
2 |
3 | // Write a function that takes three elements of any type as arguments
4 | // Create a Set from those elements
5 | // Return the result
6 |
7 | function myFunction(a, b, c) {
8 | // We may use the regular Set constructor to transform an Array into a Set:
9 | return new Set([a, b, c]);
10 |
11 | // AUTHOR'S:
12 | // const set = new Set();
13 | // set.add(a);
14 | // set.add(b);
15 | // set.add(c);
16 | // return set;
17 | }
18 |
19 | console.log(myFunction(1, "b", 3)); // Set {1, 'b', 3}
20 |
21 | console.log(myFunction(NaN, null, false)); // Set {NaN, null, false}
22 |
23 | console.log(myFunction("a", ["b"], { c: 3 })); // Set {'a', ['b'], { c: 3 }
24 |
--------------------------------------------------------------------------------
/06 - Javascript Sets/05.js:
--------------------------------------------------------------------------------
1 | // Delete element from Set
2 |
3 | // Write a function that takes a Set and a value as argument
4 | // If existing in the Set, remove the value from the Set
5 | // Return the result
6 |
7 | function myFunction(set, val) {
8 | set.delete(val);
9 | return set;
10 | }
11 |
12 | console.log(myFunction(new Set([1, 2, 3]), 1)); // new Set([2, 3])
13 |
14 | console.log(myFunction(new Set("12345"), "3")); // new Set(['1', '2', '4', '5'])
15 |
16 | console.log(myFunction(new Set([1, 2, 3]), 4)); // new Set([1, 2, 3])
17 |
--------------------------------------------------------------------------------
/06 - Javascript Sets/06.js:
--------------------------------------------------------------------------------
1 | // Add multiple elements to Set
2 |
3 | // Write a function that takes a Set and an array as arguments
4 | // If not already existing, add each element in the array to the Set
5 | // Return the modified Set
6 |
7 | function myFunction(set, arr) {
8 | arr.forEach((el) => set.add(el));
9 | return set;
10 | }
11 |
12 | console.log(myFunction(new Set([1, 2, 3]), [4, 5, 6])); // new Set([1, 2, 3, 4, 5, 6 ])
13 |
14 | console.log(myFunction(new Set("12345"), [..."6789"])); // new Set([...'123456789'])
15 |
16 | console.log(myFunction(new Set([1, 2, 3]), [2, 3])); // new Set([1, 2, 3])
17 |
--------------------------------------------------------------------------------
/06 - Javascript Sets/07.js:
--------------------------------------------------------------------------------
1 | // Get Intersection of two Javascript Sets
2 |
3 | // Write a function that takes two sets, say setA and setB, as arguments
4 | // Get the intersection of the sets
5 | // In other words, return a set containing all elements that are both in setA as well as setB
6 |
7 | function myFunction(setA, setB) {
8 | const set = new Set();
9 | setB.forEach((el) => setA.has(el) && set.add(el));
10 | return set;
11 | }
12 |
13 | console.log(myFunction(new Set([1, 2, 3]), new Set([4, 5, 6]))); // new Set()
14 |
15 | console.log(myFunction(new Set("12345"), new Set([..."45678"]))); // new Set('45')
16 |
17 | console.log(myFunction(new Set([1, 2, 3]), new Set([2, 3, 4]))); // new Set([2, 3])
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # [JSchallenger](https://www.jschallenger.com)
2 |
3 | Learn Javascript online by solving coding exercises.
4 |
5 |
6 |
7 |
8 |
9 |
10 | - What: JavaScript challenges from JSchallenger.com. It includes my own code in case I got it right as well as challenge's author code.
11 | - Why: Just in case someone is starting, as I am currently, to learn JS and wants to practice.
12 |
13 | Big thanks to [Erik Kückelheim](https://www.erik-kueckelheim.com), the author of JSchallenger.com. It's not easy to find such good exercises for free.
14 |
15 | # Index
16 |
17 | ## [Getting started](01%20-%20Getting%20started/gettingStarter.js)
18 |
19 | ## Javascript basics
20 |
21 | - [Check if a number is even](02%20-%20Javascript%20basics/01.js)
22 | - [Multiplication, division, and comparison operators](02%20-%20Javascript%20basics/02.js)
23 | - [Comparison operators, strict equality](02%20-%20Javascript%20basics/03.js)
24 | - [Check if a number is a whole number](02%20-%20Javascript%20basics/04.js)
25 | - [Check whether a string contains another string and concatenate](02%20-%20Javascript%20basics/05.js)
26 | - [Find next higher natural number that is divisble by y](02%20-%20Javascript%20basics/06.js)
27 | - [Round a number to 2 decimal places](02%20-%20Javascript%20basics/07.js)
28 | - [Split a number into its digits](02%20-%20Javascript%20basics/08.js)
29 | - [Find the correct word by incrementing letters in alphabet](02%20-%20Javascript%20basics/09.js)
30 | - [Clear up the chaos behind these strings](02%20-%20Javascript%20basics/10.js)
31 | - [Return the percentage of a number](02%20-%20Javascript%20basics/11.js)
32 | - [How many times does a character occur?](02%20-%20Javascript%20basics/12.js)
33 | - [Return the next higher prime number](02%20-%20Javascript%20basics/13.js)
34 |
35 | ## Javascript arrays
36 |
37 | - [Sort an array of strings alphabetically](03%20-%20Javascript%20arrays/01.js)
38 | - [Sort an array of numbers in descending order](03%20-%20Javascript%20arrays/02.js)
39 | - [Return last n array elements](03%20-%20Javascript%20arrays/03.js)
40 | - [Sum up all array elements with values greater than](03%20-%20Javascript%20arrays/04.js)
41 | - [Return the average of an array of numbers](03%20-%20Javascript%20arrays/05.js)
42 | - [Check if all array elements are equal](03%20-%20Javascript%20arrays/06.js)
43 | - [Remove a specific array element](03%20-%20Javascript%20arrays/07.js)
44 | - [Create a range of numbers](03%20-%20Javascript%20arrays/08.js)
45 | - [Return the longest string from an array of strings](03%20-%20Javascript%20arrays/09.js)
46 | - [Merge an arbitrary number of arrays](03%20-%20Javascript%20arrays/10.js)
47 | - [Merge two arrays with duplicate values](03%20-%20Javascript%20arrays/11.js)
48 |
49 | ## Javascript dates
50 |
51 | - [Check if two dates fall on the exact same day](04%20-%20Javascript%20dates/01.js)
52 | - [Check if two dates are equal](04%20-%20Javascript%20dates/02.js)
53 | - [Check if one date is earlier than another](04%20-%20Javascript%20dates/03.js)
54 | - [Add n days to an existing date](04%20-%20Javascript%20dates/04.js)
55 | - [Check if two dates are within 1 hour from each other](04%20-%20Javascript%20dates/05.js)
56 | - [Return the number of days between two dates](04%20-%20Javascript%20dates/06.js)
57 | - [Calculate difference between two dates in hours, minutes, and seconds](04%20-%20Javascript%20dates/07.js)
58 | - [Return the next nearest quarter hour of a date](04%20-%20Javascript%20dates/08.js)
59 |
60 | ## Javascript objects
61 |
62 | - [Accessing object properties two](05%20-%20Javascript%20objects/01.js)
63 | - [Accessing object properties one](05%20-%20Javascript%20objects/02.js)
64 | - [Accessing object properties three](05%20-%20Javascript%20objects/03.js)
65 | - [Remove a property from an object](05%20-%20Javascript%20objects/04.js)
66 | - [Swap object keys and values](05%20-%20Javascript%20objects/05.js)
67 | - [Add property to each object in array](05%20-%20Javascript%20objects/06.js)
68 | - [Merge two objects with matching keys](05%20-%20Javascript%20objects/07.js)
69 | - [Extracting information from objects](05%20-%20Javascript%20objects/08.js)
70 | - [Replace empty strings in object with null values](05%20-%20Javascript%20objects/09.js)
71 |
72 | ## Javascript Sets
73 |
74 | - [Check if value is present in Set](06%20-%20Javascript%20Sets/01.js)
75 | - [Convert a Set to Array](06%20-%20Javascript%20Sets/02.js)
76 | - [Get union of two sets](06%20-%20Javascript%20Sets/03.js)
77 | - [Creating Javascript Sets](06%20-%20Javascript%20Sets/04.js)
78 | - [Delete element from Set](06%20-%20Javascript%20Sets/05.js)
79 | - [Add multiple elements to Set](06%20-%20Javascript%20Sets/06.js)
80 | - [Get Intersection of two Javascript Sets](06%20-%20Javascript%20Sets/07.js)
81 |
--------------------------------------------------------------------------------
/README/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kvdos/JSchallenger/29c4648bd07c61b2813eb89c1a3f93d00bb5ac8e/README/logo.png
--------------------------------------------------------------------------------