-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathes6scripts.js
More file actions
23 lines (18 loc) · 807 Bytes
/
es6scripts.js
File metadata and controls
23 lines (18 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const D = require('./data');
let data = D.DataList();
let months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
let obj = {name: 'Chethan', company: 'Lucida', life: ''}
Object.keys(obj).forEach((K) => (obj[K] === '') && delete obj[K]);
console.log('------------', obj);
let user = {
name: "John",
age: 30
};
// loop over values
Object.values(user).forEach(U => console.log('****', U));
Object.keys(user).forEach(U => console.log(U + '---' + user[U]));
// -----------------------------------------
let R = data.filter(F => F.resource.trim() === 'Chethan');
let cSort = R.sort((a, b) => months.indexOf(a.Month) - months.indexOf(b.Month));
console.log('custom sort', cSort);
console.log('Filter by estimate', data.filter(r => r.estimate > 18).length);