DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 970,177 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
duccanhole
duccanhole

Posted on

code every day with me

--DAY 2--
Hi, I am going to make #100DaysOfCode Challenge.Everyday I will try solve 1 problem from leetcode or hackerrank. Hope you can go with me until end.
This is 2nd day:
-Problem: Staircase
-Detail: https://www.hackerrank.com/challenges/staircase/problem
-My solution (javascript):

function staircase(n) {
    let line=[];
    line.length=n;
    line.fill(' ');
    for(let i=0;i<n;i++){
        line.shift();
        line.push('#');
        console.log(line.join(''));
    }
}
Enter fullscreen mode Exit fullscreen mode

--> If you have better solution or any question, please comment below. I will appreciate.

Top comments (0)

This post blew up on DEV in 2020:

js visualized

πŸš€βš™οΈ JavaScript Visualized: the JavaScript Engine

As JavaScript devs, we usually don't have to deal with compilers ourselves. However, it's definitely good to know the basics of the JavaScript engine and see how it handles our human-friendly JS code, and turns it into something machines understand! πŸ₯³

Happy coding!