- Fork and clone this repo to your computer
- Open vs-code. In the terminal
ctrl + j
typenpm i
and press enter - Add a file named
.gitignore
and type in this:node_modules
- Now the
node_modules
folder should be greyd out
Congratulations ๐
You are ready to begin!
Write your code in the file Exercise.js
in the pre-made functions.
- Commit after each question you solve
- Do not change any function's name
- Do not delete any other piece of code, only add yours
- Do not edit any of the other files
- Uncomment line 3 if you solved the bonus question
You can test your code on your own in the Exercise.js
file.
But, to pass the task you should also pass the automated tests. You should have 6/6 (you start with 1/6 because of the bonus)
To run the tests type npm test
and press enter.
Write a JavaScript function that reverse a string.
Example x = "Cyber4s;
Expected Output : s4rebyC
Write a JavaScript function that generates all combinations of a string.
Example string : 'dog'
Expected Output : d,do,dog,o,og,g
Write a JavaScript function that accepts a string as a parameter and converts the first letter of each word of the string in upper case.
Example string : 'the quick brown fox'
Expected Output : 'The Quick Brown Fox '
Write a JavaScript function to compute the value of x^n where n is the exponent and x is the bases.
Write a JavaScript function to find the first not repeated character.
Sample arguments : 'abacddbec'
Expected output : 'e'
Write a JavaScript function which says whether a number is perfect.
According to Wikipedia : In number theory, a perfect number is a positive integer that is equal to the sum of its proper
positive divisors, that is, the sum of its positive divisors excluding the number itself (also known as its aliquot sum.
Equivalently, a perfect number is a number that is half the sum of all of its positive divisors (including itself).
Example : The first perfect number is 6, because 1, 2, and 3 are its proper positive divisors, and 1 + 2 + 3 = 6.
Equivalently, the number 6 is equal to half the sum of all its positive divisors: ( 1 + 2 + 3 + 6 ) / 2 = 6. The next
perfect number is 28 = 1 + 2 + 4 + 7 + 14. This is followed by the perfect numbers 496 and 8128.