Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Function to create diamond shape given a value in JavaScript?
You can create your own function to create diamond shapes for a given value. Following is the code −
Example
function createDimondShape(size){
for(var i=1;i=i;s--){
process.stdout.write(" ");
}
for(var j=1;jTo run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo58.js.
Output
This will produce the following output −
PS C:\Users\Amit\JavaScript-code> node demo58.js
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
* * * * * * * *
* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*
Advertisements
