Skip to content

Instantly share code, notes, and snippets.

View mirajehossain's full-sized avatar
🧨
DO NOT DISTURBED

Md. Alamin (Miraje) mirajehossain

🧨
DO NOT DISTURBED
View GitHub Profile
@mirajehossain
mirajehossain / Contest_Guide.md
Created June 14, 2017 19:01 — forked from dhammikamare/Contest_Guide.md
Tutorial for create your own contest on HackerRank.
@mirajehossain
mirajehossain / server.js
Last active August 22, 2017 11:12
This is for basic express server configuration for API
const express = require('require');
const app = express();
const bodyParser = require('body-parser');
const morgan = require('morgan');
const port = process.env.PORT || 8080;
app.use(bodyParser.urlencoded({extended:false}));
app.use(bodyParser.json());
app.use(morgan('dev'));
@mirajehossain
mirajehossain / js.md
Created August 25, 2017 15:34 — forked from nuhil/js.md
Javascript Handbook

Javascript Handbook

A hand crafted markdown document contains all major Javascript topics covered, taken from different sources. Brush Up your JS memory.

Comments


Single line comments start with //. For multi-line commands, you use /* ... */

// This is a single line comment
/**
* Create a student class and two overloading constructor which are takes parameters,
* create array of object and set two constructor dynamically and print information.
**/
#include<iostream>
using namespace std;
class student
{
let arr= [1,2,3,4,5,6,7,8,9,10];
let newArr = arr.map(item => {
return item % 2 == 0? item * item : item;
});
console.log(newArr);
/// OUTPUT:  [1, 4, 3, 16, 5, 36, 7, 64, 9, 100]
let numbers = [1,2,3,4,5,6,7,8,9];
let newNumbers = numbers.map(function(item){
return item+5;
});
console.log(newNumbers);
/// OUTPUT: [6, 7, 8, 9, 10, 11, 12, 13, 14]
/**
* আরো সহজ ভাবে es6 এ অ্যারো ফাংশন ব্যবহার করে
* লিখাযায়
let departments = [
{ name: 'CSE', student: 7000},
{ name: 'EEE', student: 2000},
{ name: 'CSIT', student: 5000},
{ name: 'ME', student: 4500},
{ name: 'ENGLISH',student: 6000},
{ name: 'BBA', student: 8000},
{ name: 'LAW', student: 2500}
];
let newDepartments = departments.filter(department=>{
return department.student<=5000;
});
//output:
[
{ name: 'EEE', student: 2000},
{ name: 'CSIT', student: 5000},
{ name: 'ME', student: 4500},
{ name: 'LAW', student: 2500}
]
let numbers = [1,2,3,4,5,6,7,8,9,10];
// using for loop
let evenNumbers = [];
for(let i=0; i<numbers.length; i++){
if(numbers[i] % 2 === 0) evenNumbers.push(numbers[i]);
}
console.log(evenNumbers);
// using filter
let evenNumbers = numbers.filter(item=> item % 2 === 0);
let arr = [1,2,3,4,5];
let result = arr.reduce((accumulator,currentValue)=>{
return accumulator + currentValue;
});
console.log(result); /// 15