Last active
April 30, 2019 13:49
-
-
Save completejavascript/f0912a7dd2cfc340272bd9261ba5e966 to your computer and use it in GitHub Desktop.
This file contains 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
const f1 = a => a; | |
const f2 = (a, b) => a + b; | |
const f3 = (a, b, c) => a + b + c; | |
const func = (type, ...params) => { | |
/* Hoàn thành hàm này */ | |
} | |
func(1, 1); // -> 1 (1) | |
func(2, 1, 2); // -> 3 (1 + 2) | |
func(3, 1, 2, 3);// -> 6 (1 + 2 + 3) |
This file contains 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
/* | |
* Định dạng lại số thập phân 'number', | |
* với số lượng chữ số thập phân sau dấu phẩy tối đa là 'maxDecimal' | |
*/ | |
const format = (number, maxDecimal) => { | |
/* Hoàn thành hàm này */ | |
} | |
console.log(format(1, 2)); // => 1; | |
console.log(format(1.1, 2)); // => 1.1; | |
console.log(format(1.123, 2)); // => 1.12; | |
console.log(format(1.125, 2)); // => 1.13; |
This file contains 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
/* | |
* Convert mảng màu rgb thành hex | |
*/ | |
const toHex = (r, g, b) => { | |
/* Hoàn thành hàm này */ | |
} | |
console.log(toHex(0, 255, 255)); // => #00ffff | |
console.log(toHex(255, 0, 255)); // => #ff00ff | |
console.log(toHex(255, 255, 0)); // => #ffff00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment