Skip to main content
added 16 characters in body
Source Link

I prefer use functional and prototypical inheritance over native loops because it's cleaner. And I use MAP because ES6 feature is far more short and useful, though MAP has no side effects.

const arrreversedArr = (n) => Array.from(Array(n).keys()).reverse()

const staircase = (n) => arrreversedArr(n).map((value, index) => {
        return console.log(' '.repeat(value)+'#'.repeat(index+1)+'\n')
    })

staircase(50)

func is a output of a logic: Array.from(Array(n).keys()).reverse() that receives n:integer parameter.

Array.from is a new syntax from ES6, it means that you can fill an array from "here" to "there" ie: Array.from(0, 6) returns [0,1,2,3,4,5,6]

so all the staircase(n) return is a output of map of this array. Such array that receive Array(n).keys() and reverses it with prototype reverse()

so that the array could be: [6,5,4,3,2,1,0] instead.

the map repeat iterate over the array created from Array.from(Array(n).keys()).reverse() and return a log for each item such as every item repeats ' ' (blank space) + "#" at the end of this string.

I prefer use functional and prototypical inheritance over native loops because it's cleaner. And I use MAP because ES6 feature is far more short and useful, though MAP has no side effects.

const arr = (n) => Array.from(Array(n).keys()).reverse()

const staircase = (n) => arr(n).map((value, index) => {
        return console.log(' '.repeat(value)+'#'.repeat(index+1)+'\n')
    })

staircase(50)

func is a output of a logic: Array.from(Array(n).keys()).reverse() that receives n:integer parameter.

Array.from is a new syntax from ES6, it means that you can fill an array from "here" to "there" ie: Array.from(0, 6) returns [0,1,2,3,4,5,6]

so all the staircase(n) return is a output of map of this array. Such array that receive Array(n).keys() and reverses it with prototype reverse()

so that the array could be: [6,5,4,3,2,1,0] instead.

the map repeat iterate over the array created from Array.from(Array(n).keys()).reverse() and return a log for each item such as every item repeats ' ' (blank space) + "#" at the end of this string.

I prefer use functional and prototypical inheritance over native loops because it's cleaner. And I use MAP because ES6 feature is far more short and useful, though MAP has no side effects.

const reversedArr = (n) => Array.from(Array(n).keys()).reverse()

const staircase = (n) => reversedArr(n).map((value, index) => {
        return console.log(' '.repeat(value)+'#'.repeat(index+1)+'\n')
    })

staircase(50)

func is a output of a logic: Array.from(Array(n).keys()).reverse() that receives n:integer parameter.

Array.from is a new syntax from ES6, it means that you can fill an array from "here" to "there" ie: Array.from(0, 6) returns [0,1,2,3,4,5,6]

so all the staircase(n) return is a output of map of this array. Such array that receive Array(n).keys() and reverses it with prototype reverse()

so that the array could be: [6,5,4,3,2,1,0] instead.

the map repeat iterate over the array created from Array.from(Array(n).keys()).reverse() and return a log for each item such as every item repeats ' ' (blank space) + "#" at the end of this string.

deleted 3 characters in body
Source Link

I prefer use functional and prototypical inheritance over native loops because it's cleaner. And I use MAP because ES6 feature is far more short and useful, though MAP has no side effects.

varconst funcarr = (n) => Array.from(Array(n).keys()).reverse() 

const staircase = (n) => {
    var fun = funcarr(n).map((value, index, arr) => {
        return console.log(' '.repeat(value)+'#'.repeat(index+1)+'\n')
    })
    return fun
}

staircase(1050)

func is a output of a logic: Array.from(Array(n).keys()).reverse() that receives n:integer parameter.

Array.from is a new syntax from ES6, it means that you can fill an array from "here" to "there" ie: Array.from(0, 6) returns [0,1,2,3,4,5,6]

so all the staircase(n) return is a output of map of this array. Such array that receive Array(n).keys() and reverses it with prototype reverse()

so that the array could be: [6,5,4,3,2,1,0] instead.

the map repeat iterate over the array created from Array.from(Array(n).keys()).reverse() and return a log for each item such as every item repeats ' ' (blank space) + "#" at the end of this string.

I prefer use functional and prototypical inheritance over native loops because it's cleaner. And I use MAP because ES6 feature is far more short and useful, though MAP has no side effects.

var func = (n) => Array.from(Array(n).keys()).reverse()
staircase = (n) => {
    var fun = func(n).map((value, index, arr)=>{
        return console.log(' '.repeat(value)+'#'.repeat(index+1)+'\n')
    })
    return fun
}

staircase(10)

func is a output of a logic: Array.from(Array(n).keys()).reverse() that receives n:integer parameter.

Array.from is a new syntax from ES6, it means that you can fill an array from "here" to "there" ie: Array.from(0, 6) returns [0,1,2,3,4,5,6]

so all the staircase(n) return is a output of map of this array. Such array that receive Array(n).keys() and reverses it with prototype reverse()

so that the array could be: [6,5,4,3,2,1,0] instead.

the map repeat iterate over the array created from Array.from(Array(n).keys()).reverse() and return a log for each item such as every item repeats ' ' (blank space) + "#" at the end of this string.

I prefer use functional and prototypical inheritance over native loops because it's cleaner. And I use MAP because ES6 feature is far more short and useful, though MAP has no side effects.

const arr = (n) => Array.from(Array(n).keys()).reverse() 

const staircase = (n) => arr(n).map((value, index) => {
        return console.log(' '.repeat(value)+'#'.repeat(index+1)+'\n')
    })

staircase(50)

func is a output of a logic: Array.from(Array(n).keys()).reverse() that receives n:integer parameter.

Array.from is a new syntax from ES6, it means that you can fill an array from "here" to "there" ie: Array.from(0, 6) returns [0,1,2,3,4,5,6]

so all the staircase(n) return is a output of map of this array. Such array that receive Array(n).keys() and reverses it with prototype reverse()

so that the array could be: [6,5,4,3,2,1,0] instead.

the map repeat iterate over the array created from Array.from(Array(n).keys()).reverse() and return a log for each item such as every item repeats ' ' (blank space) + "#" at the end of this string.

deleted 3 characters in body
Source Link

I prefer use functional and prototypical inheritance over native loops because it's cleaner. And I use MAP because ES6 feature is far more short and useful, though MAP has no side effects.

var func = (n) => Array.from(Array(n).keys()).reverse()
function staircase = (n) => {
    var fun = func(n).map((value, index, arr)=>{
        return console.log(' '.repeat(value)+'#'.repeat(index+1)+'\n')
    })
    return fun
}

staircase(10)

func is a output of a logic: Array.from(Array(n).keys()).reverse() that receives n:integer parameter.

Array.from is a new syntax from ES6, it means that you can fill an array from "here" to "there" ie: Array.from(0, 6) returns [0,1,2,3,4,5,6]

so all the staircase(n) return is a output of map of this array. Such array that receive Array(n).keys() and reverses it with prototype reverse()

so that the array could be: [6,5,4,3,2,1,0] instead.

the map repeat iterate over the array created from Array.from(Array(n).keys()).reverse() and return a log for each item such as every item repeats ' ' (blank space) + "#" at the end of this string.

I prefer use functional and prototypical inheritance over native loops because it's cleaner. And I use MAP because ES6 feature is far more short and useful, though MAP has no side effects.

var func = (n) => Array.from(Array(n).keys()).reverse()
function staircase(n) {
    var fun = func(n).map((value, index, arr)=>{
        return console.log(' '.repeat(value)+'#'.repeat(index+1)+'\n')
    })
    return fun
}

staircase(10)

func is a output of a logic: Array.from(Array(n).keys()).reverse() that receives n:integer parameter.

Array.from is a new syntax from ES6, it means that you can fill an array from "here" to "there" ie: Array.from(0, 6) returns [0,1,2,3,4,5,6]

so all the staircase(n) return is a output of map of this array. Such array that receive Array(n).keys() and reverses it with prototype reverse()

so that the array could be: [6,5,4,3,2,1,0] instead.

the map repeat iterate over the array created from Array.from(Array(n).keys()).reverse() and return a log for each item such as every item repeats ' ' (blank space) + "#" at the end of this string.

I prefer use functional and prototypical inheritance over native loops because it's cleaner. And I use MAP because ES6 feature is far more short and useful, though MAP has no side effects.

var func = (n) => Array.from(Array(n).keys()).reverse()
staircase = (n) => {
    var fun = func(n).map((value, index, arr)=>{
        return console.log(' '.repeat(value)+'#'.repeat(index+1)+'\n')
    })
    return fun
}

staircase(10)

func is a output of a logic: Array.from(Array(n).keys()).reverse() that receives n:integer parameter.

Array.from is a new syntax from ES6, it means that you can fill an array from "here" to "there" ie: Array.from(0, 6) returns [0,1,2,3,4,5,6]

so all the staircase(n) return is a output of map of this array. Such array that receive Array(n).keys() and reverses it with prototype reverse()

so that the array could be: [6,5,4,3,2,1,0] instead.

the map repeat iterate over the array created from Array.from(Array(n).keys()).reverse() and return a log for each item such as every item repeats ' ' (blank space) + "#" at the end of this string.

added 162 characters in body
Source Link
Loading
added 676 characters in body
Source Link
Loading
Source Link
Loading