We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
the underline is the first parameter of the calbback arrow function. It would return the value of the array in this case. As it is not what he wants but rather the index, he just named it that way.
The same solution here, but I prefer something more readable.
let result = [];
for (let i = 0; i < n; i++){
result[i] = Array((n) - (i)).join(" ");
result[i] = result[i].concat(`${Array(i+2).join('#')}`)
}
return result.join('\n')
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Staircase
You are viewing a single comment's thread. Return to all comments →
the underline is the first parameter of the calbback arrow function. It would return the value of the array in this case. As it is not what he wants but rather the index, he just named it that way.
The same solution here, but I prefer something more readable.