Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Development #1

wants to merge 2 commits into from

Conversation

hnamazli
Copy link
Owner

No description provided.

Copy link

@Daymon4 Daymon4 left a comment

Choose a reason for hiding this comment

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

Minor fixes

Comment on lines +31 to +46
const getTriangleOne = size => {
let str = '';

for (let i = size; i > 0; i--) {
for (let j = 0; j < size + 1; j++) {
if (j >= i) {
str += '*';
} else {
str += ' ';
}
}
str += '\n';
}

console.log(str);
}
Copy link

Choose a reason for hiding this comment

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

Other variant:

const getTriangleOne = size => {
    let str = '';

    for (let i =0; i < size; i++) {
        for (let j = 0; j < size; j++) {
            if (j >= size - 1 - i) {
                str += '*';
            } else {
                str += ' ';
            }
        }
        str += '\n';
    }

    console.log(str);
}


for (let i = 0; i < size; i++) {
for (let j = 0; j < size; j++) {
if (i <= j) {
Copy link

Choose a reason for hiding this comment

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

Other variant: if (j >= i) {

Comment on lines +82 to +97
const getTriangleFour = size => {
let str = '';

for (let i = size; i > 0; i--) {
for (let j = 0; j < size + 1; j++) {
if (i > j) {
str += '*';
} else {
str += ' ';
}
}
str += '\n';
}

console.log(str);
}
Copy link

Choose a reason for hiding this comment

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

Other variant:

const getTriangleFour = size => {
    let str = '';

    for (let i = 0; i < size; i++) {
        for (let j = 0; j < size; j++) {
            if (j <= size - 1 - i) {
                str += '*';
            } else {
                str += ' ';
            }
        }
        str += '\n';
    }

    console.log(str);
}

Comment on lines +102 to +104
for (let i = 0; i < size; i++) {
for (let j = size; 0 < j; j--) {
if (j - 1 === i || j === 1 || i === size - 1) {
Copy link

Choose a reason for hiding this comment

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

for (let i = 0; i < size; i++) {
        for (let j = 0; j < size; j++) {
            if (i === size - 1 || j === size - 1 || j === size - 1 - i) {

Comment on lines +153 to +155
for (let i = 0; i < size; i++) {
for (let j = size; 0 < j; j--) {
if (j - 1 === i || i === 0 || j === size) {
Copy link

Choose a reason for hiding this comment

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

    for (let i = 0; i < size; i++) {
        for (let j = 0; j < size; j++) {
            if (i === 0 || j === 0 || i === size - 1 - j) {


for (let i = 0; i < size; i++) {
for (let j = 0; j < size; j++) {
if (j === i || i === size - j - 1) {
Copy link

Choose a reason for hiding this comment

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

if (j === i || j === size - i - 1) {


for (let i = 0; i < size; i++) {
for (let j = 0; j < size; j++) {
if (j === i || i === size - j - 1 || i === 0 || i === size - 1) {
Copy link

Choose a reason for hiding this comment

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

j === size - 1 - i


for (let i = 0; i < size; i++) {
for (let j = 0; j < size; j++) {
if ((j < i) && (i >= size - j) || (j > i) && (j < size - i) || j === i || i === size - 1 || i === size - j - 1) {
Copy link

Choose a reason for hiding this comment

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

if (j >= i && j <= size - 1 - i || j >= size - 1 - i && j <= i) {

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