Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //- VIET HAM XOA N PHAN TU BEN TRAI CUA HAM CHO TRUOC
- const bai1 = (val, n) => {
- return val.slice(n);
- };
- //console.log('bai 1: ',bai1('asd',1));
- //- VIET HAM TINH THOI GIAN THUC THI Cua 1 HAM
- const bai2 = (fn) => {
- const result = fn();
- }
- console.log(bai2(() => 5+3));
- //- VIET HAM NHAN 1 URL CHUYEN URL THANH cac OBJECT
- //VD http://www.example.com?firstName=A&lastName=Nguyen
- const bai3 = (url) => {
- url = url.slice(url.indexOf('?')+1);
- return url.split('&')
- .map((v,i) => v.split('='))
- .map((v,i) => ( { [v[0]] : v[1] } ));
- }
- //console.log('bai 3: ',bai3('http://www.example.com?firstName=A&lastName=Nguyen'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement