Guest User

Untitled

a guest
Oct 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. function giveMeNofX(N,x) {
  2. return (x instanceof Array ? x : []).slice(0,N).concat(Array.apply(null,Array(N))).slice(0,N)
  3. }
  4.  
  5. giveMeNofX(2,[1,2,3]) //1,2
  6. giveMeNofX(100,[1,2,3]) //1,2,3,undefined.....
Add Comment
Please, Sign In to add comment