Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function giveMeNofX(N,x) {
- return (x instanceof Array ? x : []).slice(0,N).concat(Array.apply(null,Array(N))).slice(0,N)
- }
- giveMeNofX(2,[1,2,3]) //1,2
- giveMeNofX(100,[1,2,3]) //1,2,3,undefined.....
Add Comment
Please, Sign In to add comment