Skip to content

Instantly share code, notes, and snippets.

View zonayedpca's full-sized avatar
:octocat:
Coffee, Coke, Code

Zonayed Ahmed zonayedpca

:octocat:
Coffee, Coke, Code
View GitHub Profile
function sumMachine(a, b) {
var sum = a + b;
return sum;
}
console.log(sumMachine(2, 2));
console.log(sumMachine(4, 4));
@zonayedpca
zonayedpca / function.js
Created March 29, 2018 16:54
Basic Function
var funcName = function() {
console.log('Hello I am from the function');
}
funcName();
@zonayedpca
zonayedpca / function.js
Created March 29, 2018 16:52
Basic Function
function funcName() {
console.log('Hello I am from the function');
}
funcName();
@zonayedpca
zonayedpca / forinloop.js
Created March 24, 2018 16:12
For In Loop
var items = [1, 2, 3, 4, 5, 6];
for(item in items) {
console.log(item);
}
for(var i = 0; i < 10; i++) {
if(i === 5) {
console.log(i + ' is skipped');
continue;
}
console.log('i is now at: ' + i);
}
for(var i = 0; i < 10; i++) {
if(i === 5) {
break;
}
console.log('i is now at: ' + i);
}
@zonayedpca
zonayedpca / whileloop2.js
Created March 24, 2018 15:57
While Loop 2
var num = 20;
while(num < 10) {
console.log('Inside the Loop');
num = prompt('Enter the number: ');
}
console.log('Out of the loop');
@zonayedpca
zonayedpca / whileloop.js
Created March 24, 2018 15:45
While Loop
var num = 0;
while(num < 10) {
num = prompt('Enter the number: ');
}
console.log('Out of the loop');
@zonayedpca
zonayedpca / dowhile.js
Last active March 24, 2018 15:48
Do While Loop
var num;
do {
console.log('Inside the Loop');
num = prompt('Enter the number: ');
} while(num < 10);
console.log('Outside the Loop');
@zonayedpca
zonayedpca / forloop.js
Created March 24, 2018 15:20
For Loop
for(var i = 0; i < 10; i++) {
console.log('Go ' + i + ' step');
}