-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
59 lines (22 loc) · 1.51 KB
/
test.js
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
55
56
57
58
59
//ilk hali [ 'ts (2 min)', 'pyt (5 min)', 'css (10 min)', 'js (12 min)', 'java (15 min)' ]
//js en öne geldi = [ 'js (12 min)' ||||||| , 'ts (2 min)', 'pyt (5 min)', 'css (10 min)', 'java (15 min)' ]
//pyt en öne geldi = [ 'pyt (5 min)', 'js (12 min)', ||||||||| 'ts (2 min)', 'css (10 min)', 'java (15 min)' ]
//js ve pyt pinned = true ,,,, pinned = false kendi arasında sıralandı
const arr = [ 'pyt', 'js', 'ts', 'css', 'java' ];
const fromIndex = arr.indexOf('pyt'); // 👉️ 2
const element = arr.splice(fromIndex, 1)[0]; // ['ts']
const toIndex = 0
arr.splice(toIndex, 0, element);
console.log(arr); // 👉️ ['js', 'ts', 'css']
const bulkDeletedNotes = ['a','b','c','d','e','f']
const arr2 = ['a','b','c']
for (var i = arr2.length -1; i >= 0; i--)
bulkDeletedNotes.splice(arr2[i],1); //Remove 1 element at arr2[i]
console.log('yeniBulkDelete:' , bulkDeletedNotes)
const ourNotes = [{"date": "2023-03-20T15:22:10.184Z", "id": 34853, "isPinned": false, "note": "34"},{"date": "2023-03-20T15:23:10.184Z", "id": 34854, "isPinned": false, "note": "aaaaaa"}];
const bulk = [{"date": "2023-03-20T15:22:10.184Z", "id": 34853, "isPinned": false, "note": "34"}];
const bulkIds = bulk.map(note => note.id);
const filteredNotes = ourNotes.filter(note => !bulkIds.includes(note.id));
console.log('our new notes: ',filteredNotes); // Output: [{date: '2023-03-20T15:23:10.184Z',id: 34854,isPinned: false,note: 'aaaaaa'}]
const a = ''
console.log(!a? 'evet çalışmadı' : 'hayır hala dolu ')