Skip to content

Conversation

JayaMustika
Copy link

Hello Mas Ian,

I've just finished the assignment focusing on JavaScript's Functional and Object-Oriented Programming paradigms. This PR encompasses all the tasks and sub-tasks related to the assignment.

Key Highlights:

  1. feat: finish factorial.js, fizz-buzz.js, palindrome.js, and fibonacci.js using Functional Programming
  2. feat: finish Factorial.js, FizzBuzz.js, Palindrome.js, and Fibonacci.js using Object-Oriented Programming
  3. chore: update README.js

I would highly appreciate it if you could review my code. I'm open to feedback and any suggestions you might have to enhance or correct my implementation.

Looking forward to your constructive feedback.

Best,
Jaya Mustika

Copy link
Contributor

@ianriizky ianriizky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your hard work. Unfortunately, there are still some reviews you need to work on with some other reviews I don't write here. But I leave this for now so you can focus on fixing the code while implementing it in the other code you've made. Thank you.

* Count factorial number from the given "n" value using loop way.
*
* @param {number} n
* Factorial Using Loop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a lot of whitespace at the end of each code line. If you're using VSCode, I suggest you install this extension as it will help you to automate the coding format process.


return n * countFactorialUsingRecursive(n - 1);
}
console.log (factorialUsingLoop (6));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the console.log() and any other console function as it is unnecessary and therefore will expose your code execution process which also opens up the vulnerability inside the program itself.

*
* @param {number} n
* Factorial Using Loop
* @param {*} n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this n parameter accepts any type of data, you must define the exact type of this parameter in terms to suggest the user to use the correct data type when using the function/method.

* @param {number} n
* Factorial Using Loop
* @param {*} n
* @returns
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use @returns JSDoc only if you have to. By default, the IDE will automatically give the right @returns data type based on the return value.


for (let index = n; index > 0; index--) {
result *= index;
for (let i = 1; i < n; i += 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a better variable naming instead of i as a non-expert will be confused by the meaning of this variable.

try {
const sequence = event.target["sequence"].value;
/**
* Using concept "Const of" and "Function as a parameter"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage of for of is correct, but the function as a parameter is wrong. If you want to pass the numberGenerator function as a parameter for the other function (ex: generateFizzBuzz2), don't add the paranthesis at the end of numberGenerator. See this example below:

/**
 * @param {function} callback
 */
function generateFizzBuzz2(callback) {
  callback(8);
}

/**
 * @param {number} value
 */
const numberGenerator = function (value) {
  return value;
}

generateFizzBuzz2(numberGenerator);

Comment on lines 20 to 23
console.log (array);
console.log (reverseArray);
console.log (JSON.stringify (array));
console.log (JSON.stringify (reverseArray));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


for (let index = 0; index < Math.floor(value.length / 2); index++) {
const lastCharacterIndex = value.length - (index + 1);
console.log (isPalindrome ("racecar"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


return true;
}
console.log (newValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


const firstCharacter = value[index];
const lastCharacter = value[lastCharacterIndex];
console.log (isPalindrome2 ("racecar"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@ianriizky ianriizky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created a video to explain my review of this project. Please kindly check it here: https://drive.google.com/file/d/1E8e0qDcXOOCTxxg6hsieYkZjZ1aqBCC3/view?usp=sharing. Thank you.

- [ianriizky/rwid-git](https://github.com/ianriizky/rwid-git)
- [sdesakt/rwid-challenge](https://github.com/sdesakt/rwid-challenge)
- [dianprsty/rwid-git](https://github.com/dianprsty/rwid-git)
- [JayaMustika/rwid-gi](https://github.com/JayaMustika/rwid-git)t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong github URL.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aman sudah diperbaiki Mas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants