Skip to content

Printing Shapes assignment#3

Open
Bitazee wants to merge 6 commits intoplatformps:masterfrom
Bitazee:master
Open

Printing Shapes assignment#3
Bitazee wants to merge 6 commits intoplatformps:masterfrom
Bitazee:master

Conversation

@Bitazee
Copy link

@Bitazee Bitazee commented Jun 29, 2020

No description provided.

Copy link
Contributor

@Git-Leon Git-Leon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty good.
You know fundamentals, but definitely need to work on code-reuse to minimize code redundancies.


function getBox(width, height) {
// TODO - write method definition here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not bad! Not a huge fan of the implementation though.
Consider code-reuse.

It is less redundant to reuse code that has already been written to perform what you need.
It could be more simply expressed as

function getBox(width, height) {
    let output="";
    for(let i=0;i<height;i++) {
        output += getLine(width) + "\n";
    }
    return output;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely know i have this issue when coding. I have been getting better at seeing when I start using redundant coding(it is easy to catch when I start copying and pasting lol). I was not sure how to make a new function in JS to try and stick the redundant code in.

else if(length - count == 2){
pyramid += " ";
}
else{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty else clause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants