-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
54 lines (50 loc) · 1.09 KB
/
test.js
File metadata and controls
54 lines (50 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const findSame = input => {
if (typeof input !== "object") {
return console.log("PASTIKAN ITU ARRAY");
}
let result = input;
let _result = [];
const _input = input.map(e =>
e
.split("")
.sort()
.join("")
);
let _input2 = [];
let _input3 = [];
console.log(_input);
for (let i = 0; i < _input.length; i++) {
for (let j = 0; j < _input.length; j++) {
if (_input[i] === _input[j]) {
_input3.push(_input[i]);
console.log(_input[i], i);
if (!_result.some(e => e === result[i])) {
_result.push(result[i]);
}
}
}
}
console.log(_result);
// return console.log(result);
};
// findSame([
// "man",
// "list",
// "acme",
// "talk",
// "cat",
// "beach",
// "came",
// "tac",
// "naan",
// "slit",
// "act"
// ]);
findSame(["oke", "ulala", "asik", "eko"]);
//findSame("gasss!");
const d = new Date();
const date = d.getDate();
const month = d.getMonth() + 1 ? "0" + (d.getMonth() + 1) : date;
const year = d.getFullYear();
const fullDate = `${year}-${month}-${date}`;
console.log(fullDate);