Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function spliter(n) {
- const arr = []
- return function(str) {
- const x = (str.length / n).toFixed()
- let m = n
- for (let i = 0; i < str.length; i = i + n ) {
- let y = str.slice(i, m)
- arr.push(y)
- console.log(i, m)
- m+=n
- }
- return arr
- }
- }
- let x = '123456789'
- console.log(spliter(3)('12345678910123'))
Advertisement
Add Comment
Please, Sign In to add comment