Skip to content

feat: Intro to Node.js & NPM (#39515) #6

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

Merged
merged 4 commits into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions extra/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "extra",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"pattern:diamond":" node patterns/diamond.js",
"pattern:equilateral":"node patterns/equilateral.js"

},
"author": "",
"license": "ISC"
}
32 changes: 32 additions & 0 deletions extra/patterns/diamond.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
let n=process.argv[2]

diamond(n)
function diamond(n)
{
for(let i=0;i<n;i++)
{
let str=""
for(let k=0;k<n-i-1;k++)
{
str=str+" "
}
for(let j=0;j<=i;j++)
{
str=str+"* "
}
console.log(str)
}
for(let i=n;i>0;i--)
{
let str=""
for(let k=0;k<n-i;k++)
{
str=str+" "
}
for(let j=0;j<i;j++)
{
str=str+"* "
}
console.log(str)
}
}
24 changes: 24 additions & 0 deletions extra/patterns/equilateral.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
n=process.argv[2]
equilateral(n)
function equilateral(n)
{


for(let i=0;i<n;i++)
{
let str=""
for(let k=0;k<n-i-1;k++)
{
str=str+" "
}
for(let j=0;j<=i;j++)
{

str=str+"* "
}
console.log(str)

}

}