daily pastebin goal
73%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //- VIET HAM XOA N PHAN TU BEN TRAI CUA HAM CHO TRUOC
  2. const bai1 = (val, n) => {
  3.   return val.slice(n);
  4. };
  5. //console.log('bai 1: ',bai1('asd',1));
  6. //- VIET HAM TINH THOI GIAN THUC THI Cua 1 HAM
  7. const bai2 = (fn) => {
  8.    const result = fn();
  9. }
  10. console.log(bai2(() => 5+3));
  11. //- VIET HAM NHAN 1 URL CHUYEN URL THANH cac OBJECT
  12. //VD http://www.example.com?firstName=A&lastName=Nguyen
  13. const bai3 = (url) => {
  14.     url = url.slice(url.indexOf('?')+1);
  15.     return url.split('&')
  16.     .map((v,i) => v.split('='))
  17.     .map((v,i) => ( { [v[0]] : v[1] } ));
  18. }
  19.  
  20. //console.log('bai 3: ',bai3('http://www.example.com?firstName=A&lastName=Nguyen'));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top