-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Development #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Figure JS</title> | ||
</head> | ||
<body> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,216 @@ | ||
const getSquare = size => { | ||
let str = ''; | ||
|
||
for (let i = 0; i < size; i++) { | ||
for (let j = 0; j < size; j++) { | ||
str += '*'; | ||
} | ||
str += '\n'; | ||
} | ||
|
||
console.log(str); | ||
} | ||
|
||
const getSquareEmpty = size => { | ||
let str = ''; | ||
|
||
for (let i = 0; i < size; i++) { | ||
for (let j = 0; j < size; j++) { | ||
if (i === 0 || i === size - 1 || j === 0 || j === size - 1) { | ||
str += '*'; | ||
} else { | ||
str += ' '; | ||
} | ||
} | ||
str += '\n'; | ||
} | ||
|
||
console.log(str); | ||
} | ||
|
||
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); | ||
} | ||
|
||
const getTriangleTwo = size => { | ||
let str = ''; | ||
|
||
for (let i = 0; i < size; i++) { | ||
for (let j = 0; j < size; j++) { | ||
if (j <= i) { | ||
str += '*'; | ||
} else { | ||
str += ' '; | ||
} | ||
} | ||
str += '\n'; | ||
} | ||
|
||
console.log(str); | ||
} | ||
|
||
const getTriangleThree = size => { | ||
let str = ''; | ||
|
||
for (let i = 0; i < size; i++) { | ||
for (let j = 0; j < size; j++) { | ||
if (i <= j) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other variant: |
||
str += '*'; | ||
} else { | ||
str += ' '; | ||
} | ||
} | ||
str += '\n'; | ||
} | ||
|
||
console.log(str); | ||
} | ||
|
||
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); | ||
} | ||
Comment on lines
+82
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other variant:
|
||
|
||
const getTriangleEmpOne = size => { | ||
let str = ''; | ||
|
||
for (let i = 0; i < size; i++) { | ||
for (let j = size; 0 < j; j--) { | ||
if (j - 1 === i || j === 1 || i === size - 1) { | ||
Comment on lines
+102
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
str += '*'; | ||
} else { | ||
str += ' '; | ||
} | ||
} | ||
str += '\n'; | ||
} | ||
|
||
console.log(str); | ||
} | ||
|
||
const getTriangleEmpTwo = size => { | ||
let str = ''; | ||
|
||
for (let i = 0; i < size; i++) { | ||
for (let j = 0; j < size; j++) { | ||
if (j === i || j === 0 || i === size - 1) { | ||
str += '*'; | ||
} else { | ||
str += ' '; | ||
} | ||
} | ||
str += '\n'; | ||
} | ||
|
||
console.log(str); | ||
} | ||
|
||
const getTriangleEmpThree = size => { | ||
let str = ''; | ||
|
||
for (let i = 0; i < size; i++) { | ||
for (let j = 0; j < size; j++) { | ||
if (j === i || i === 0 || j === size - 1) { | ||
str += '*'; | ||
} else { | ||
str += ' '; | ||
} | ||
} | ||
str += '\n'; | ||
} | ||
|
||
console.log(str); | ||
} | ||
|
||
const getTriangleEmpFour = size => { | ||
let str = ''; | ||
|
||
for (let i = 0; i < size; i++) { | ||
for (let j = size; 0 < j; j--) { | ||
if (j - 1 === i || i === 0 || j === size) { | ||
Comment on lines
+153
to
+155
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
str += '*'; | ||
} else { | ||
str += ' '; | ||
} | ||
} | ||
str += '\n'; | ||
} | ||
|
||
console.log(str); | ||
} | ||
|
||
const getX = size => { | ||
let str = ''; | ||
|
||
for (let i = 0; i < size; i++) { | ||
for (let j = 0; j < size; j++) { | ||
if (j === i || i === size - j - 1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
str += '*'; | ||
} else { | ||
str += ' '; | ||
} | ||
} | ||
str += '\n'; | ||
} | ||
|
||
console.log(str); | ||
} | ||
|
||
const getEmpSandHour = size => { | ||
let str = ''; | ||
|
||
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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
str += '*'; | ||
} else { | ||
str += ' '; | ||
} | ||
} | ||
str += '\n'; | ||
} | ||
|
||
console.log(str); | ||
} | ||
|
||
const getSandHour = size => { | ||
let str = ''; | ||
|
||
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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
str += '*'; | ||
} else { | ||
str += ' '; | ||
} | ||
} | ||
str += '\n'; | ||
} | ||
|
||
console.log(str); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other variant: