-
Notifications
You must be signed in to change notification settings - Fork 16
Finish Challenge JS Basic and JS OOP #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JayaMustika
wants to merge
18
commits into
ngodingbang:develop
Choose a base branch
from
JayaMustika:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3bcc341
feat: finish factorial.js using functional
JayaMustika 74e4dd7
feat: finish fibonacci.js using functional
JayaMustika 33ba4d1
feat: finish fizz-buzz.js using functional
JayaMustika f04f8c7
feat: finish palindrome.js using functional
JayaMustika 3a2feff
feat: finish factorial.js using oop
JayaMustika d3b0317
feat: finish fibonacci.js using oop
JayaMustika 81ca342
feat: finish FizzBuzz.js using oop
JayaMustika 0edf370
feat: finish Palindrome.js using oop
JayaMustika 0e85c1b
chore: update README.md
JayaMustika 912ebf0
Merge branch 'release/0.4.0'
JayaMustika ff133d8
Merge tag '0.4.0' into develop
JayaMustika 45d33a5
fix: incorporating reviews on the functional JS challenge
JayaMustika b92c97c
fix: incorporating reviews into the OOP JS Challenge
JayaMustika 818fa53
feat: update README.md
JayaMustika cd35b0c
fix: adding export statement into into OOP's html
JayaMustika 53e4794
fix: correcting some syntax error
JayaMustika c01156a
feat : finish challenge JS Module
JayaMustika ee96aee
feat : finish challenge JS Asynchronous
JayaMustika File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
export { member as m12 } from "../../modules/generateMember12.js"; | ||
export { member1 as m1 } from "./helper/generateMember1.js"; | ||
export { member2 as m2 } from "./helper/generateMember2.js"; | ||
export { member3 as m3 } from "./helper/generateMember3.js"; | ||
export { member4 as m4 } from "./helper/generateMember4.js"; | ||
export { member5 as m5 } from "./helper/generateMember5.js"; | ||
export { member6 as m6 } from "./helper/generateMember6.js"; | ||
export { member7 as m7 } from "./helper/generateMember7.js"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Person } from "./Person.js"; | ||
import { generateTrElement } from "../generateTrElement.js"; | ||
|
||
export class Member extends Person { | ||
/** @type {number} */ | ||
index; | ||
|
||
/** @type {string} */ | ||
address; | ||
|
||
/** @type {string} */ | ||
sim_batch; | ||
|
||
/** @type {string} */ | ||
github_url; | ||
|
||
/** | ||
* @param {string} name | ||
* @param {number} index | ||
* @param {string} address | ||
* @param {string} sim_batch | ||
* @param {string} github_url | ||
*/ | ||
constructor(name, index, username, sim_batch, github_url) { | ||
super(name); | ||
|
||
this.index = index; | ||
this.username = username; | ||
this.sim_batch = sim_batch; | ||
this.github_url = github_url; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Member } from "./Member.js"; | ||
|
||
const member1 = new Member( | ||
"Jaya Mustika", | ||
1, | ||
"JayaMustika", | ||
"07", | ||
"https://github.com/JayaMustika" | ||
); | ||
|
||
|
||
export { member1 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Member } from "./Member.js"; | ||
|
||
const member2 = new Member( | ||
"Muchamad Faiz", | ||
3, | ||
"muhammadfaiz", | ||
"01", | ||
"https://github.com/muchamadfaiz" | ||
); | ||
|
||
export { member2 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Member } from "./Member.js"; | ||
|
||
const member3 = new Member( | ||
"Ady Bagus", | ||
4, | ||
"itsmeeep", | ||
"07", | ||
"https://github.com/itsmeeep" | ||
); | ||
|
||
export { member3 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Member } from "./Member.js"; | ||
|
||
const member4 = new Member( | ||
"Bagus Irawan", | ||
5, | ||
"oombagus", | ||
"6", | ||
"https://www.github.com/oombagus", | ||
); | ||
|
||
export { member4 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Member } from "./Member.js"; | ||
|
||
const member5 = new Member( | ||
"Riky Ridho Pangestu", | ||
8, | ||
"ridhoriky", | ||
"02", | ||
"https://github.com/ridhoriky" | ||
); | ||
|
||
export { member5 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Member } from "./Member.js"; | ||
|
||
const member6 = new Member( | ||
"Abdurrochman Alfian", | ||
10, | ||
"Alfian-IDN", | ||
"10", | ||
"https://github.com/Alfian-IDN" | ||
); | ||
|
||
|
||
export { member6 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Member } from "./Member.js"; | ||
|
||
const member7 = new Member( | ||
"Bambang Rewanggi", | ||
11, | ||
"Rewanggi", | ||
"08", | ||
"https://github.com/Rewanggi" | ||
); | ||
|
||
export { member7 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,40 @@ | ||
import { parseNumber } from "../../js/helper.js"; | ||
|
||
/** | ||
* Count factorial number from the given "n" value using loop way. | ||
* | ||
* @param {number} n | ||
* Factorial Iterative Approach | ||
* @param {number} n | ||
*/ | ||
function countFactorialUsingLoop(n) { | ||
n = parseNumber(n); | ||
|
||
let result = 1; | ||
function factorialUsingLoop (n) { | ||
let formula = n; | ||
|
||
for (let index = n; index > 0; index--) { | ||
result *= index; | ||
for (let i = 1; i < n; i += 1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use a better variable naming instead of |
||
formula *= (n-i); | ||
} | ||
|
||
return result; | ||
return formula; | ||
} | ||
|
||
/** | ||
* Count factorial number from the given "n" value using recursive way. | ||
* | ||
* @param {number} n | ||
* @returns {number} | ||
*/ | ||
function countFactorialUsingRecursive(n) { | ||
n = parseNumber(n); | ||
|
||
if (n < 2) { | ||
return 1; | ||
} | ||
|
||
return n * countFactorialUsingRecursive(n - 1); | ||
* Factorial Recursive Approach | ||
* @param {number} n | ||
*/ | ||
function factorialUsingrecursive (n) { | ||
return n <= 1 | ||
? 1 | ||
: factorialUsingrecursive (n - 1) * n; | ||
} | ||
|
||
/** | ||
/** | ||
* Count factorial number from the given "n" value. | ||
* | ||
* @param {number} n | ||
* @param {"loop" | "recursive"} method | ||
* @throws {Error} | ||
*/ | ||
function countFactorial(n, method) { | ||
if (method == "loop") { | ||
return countFactorialUsingLoop(n); | ||
return factorialUsingLoop(n); | ||
} else if (method == "recursive") { | ||
return countFactorialUsingRecursive(n); | ||
return factorialUsingrecursive(n); | ||
} else { | ||
throw new Error("Method must be loop or recursive."); | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong github URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aman sudah diperbaiki Mas